Mysql
 SQL >> Database >  >> RDS >> Mysql

Flutter verso PHP: perché la tua app non riesce a inviare dati a MySQL

Guardando la tua API, sembra che tu stia cercando di inviare dati. Tuttavia nella tua app Flutter vedo che stai usando una richiesta GET.

Se il tuo obiettivo è inviare dati (post), dovresti mandare una richiesta POST dalla tua app Flutter invece di una GET.

Ecco un esempio di richiesta POST in Flutter usando il pacchetto HTTP.

Esempio di richiesta POST:

String url = "https://www.ekspar.com.tr/onarim/post.php"; var response = await http.post(url, body: { "adi":"YOUR_DATA", "soyadi":"YOUR_DATA" }); var body = jsonDecode(response.body); if(response.statusCode == 200){ debugPrint("Data posted successfully"); }else{ debugPrint("Something went wrong! Status Code is: ${response.statusCode}"); }