I'm trying to get the email and password from a flutter app using PHP but for some reason i'm getting null results, any idea how I can do it?
Seems that the PHP code actually works fine if the username and password are in the URL itself, however, does not work if I try to follow the example below.
PHP:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET');
echo $email = $_GET["email"];
echo $password = $_GET["password"];
Flutter:
Future<void> login(String email, String password) async {
final url = Uri.parse(
'example.com/file.php');
final response = await http.post(
url,
body: json.encode(
{
'email': email,
'password': password,
},
),
);
}