I need to receive POST data on the ESP8266.
If i use a simple HTML form to send the data to the ESP, there is no problem i can get them with:
void testausgabe(){
String data;
for (uint8_t i=0; i<server.args(); i++){
data += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
if(data != lastdata){
Serial.println(data);
}
lastdata = data;
}
but i have to send the POST-data without a HTML form, so i used PHP cURL for a trial like this:
<?php
$data = array("name"=>"john", "age"=>33);
$string = http_build_query($data);
$ch = curl_init("http://192.168.2.102/");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
?>
the PHP file itself is working fine, tested it. But i failed to receive or to use the POST-data on the ESP.
I Hope one of you have a good advice for me.
Also i hope i could explain my problem understandable because my engisch is not ss good. But i try to improve it.
@Edit: that's embarrassing. I simple forgot the // after http: now it works fine