Problem with send data to a website
Posted: Sat Dec 03, 2016 4:11 pm
Hi
I have problem with ESP8266.
I wanna send data on the web page but the data does not arrive.
I use AT command.
I send
The PHP code
The code work.
The answer
http://citizenship.5v.pl/
Thank you for help.
I have problem with ESP8266.
I wanna send data on the web page but the data does not arrive.
I use AT command.
I send
Code: Select all
AT+CWJAP="MK_WiFi","password"
AT+CWMODE=3
AT+CIPMUX=1
AT+CIPSTART=1,"TCP","77.89.97.41",80
AT+CIPSEND=1,155
POST /send.php HTTP/1.1\r\n
Host: 77.89.97.41\r\n
Content-type: application/x-www-form-urlencoded\r\n
Content-length: 19\r\n\r\n
field=255&value=255
The PHP code
Code: Select all
<?php
include("./admin/config.php");
$field = $_POST['field'];
$value = $_POST['value'];
echo '<! DOCTYPE HTML PUBLIC "- // // DTD HTML IETF 1.1 // EN">
<html>
<head>
<title>Wysylanie daty</title>
</head>
<body>';
db_connect();
$datenow = date("Y-m-d H:i:s");
$sql = "INSERT INTO test (logdata, field, value) VALUES('$datenow', '$field', '$value')";
$result = mysql_query($sql);
echo "Wyslano....";
db_close();
?>
</body>
</html>
The code work.
The answer
Code: Select all
+IPD,1,462:HTTP/1.1 400 Bad Request
Date: Sat, 03 Dec 2016 15:56:04 GMT
Server: Apache
Content-Length: 296
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Request header field is missing ':' separator.<br />
<pre>
\n\r</pre>
</p>
</body></html>
OK
http://citizenship.5v.pl/
Thank you for help.