Problem with send data on the website

matti9410
Posts: 1
Joined: Sun Dec 04, 2016 1:06 am

Problem with send data on the website

Postby matti9410 » Sun Dec 04, 2016 5:13 am

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

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


Thank you for help.

ESP_Greg

Re: Problem with send data on the website

Postby ESP_Greg » Mon Dec 12, 2016 5:21 pm

Hi matti9410,
This is Greg, did I write back to you about this issue from feedback? I don't quite remember.....

Who is online

Users browsing this forum: No registered users and 3 guests