My set up is following-
1. I have a device which will connect to server and send data using HTTP POST. It can be programmed using python.
2. When php server will receive that data through POST request from the client device, it will process data and save it to database.
My problem is in communication where I send the data from device using the POST method above but in server side I don't receive any data. So, what may go wrong?
I believe problem may be in 2 places-
1. I am either making mistake in POST method.
2. Or, my server side script is wrong.
I am also testing it using telnet to my localhost.
My POST method is the following-
Code: Select all
POST /insert.php HTTP/1.1
Host: http://www.mysite.com
Content-Type: text/plain; charset=iso-8859-1
Content-Length: 10
data=1234567890
Code: Select all
<?php
$str = $_POST['data'];
echo $str;
?>
Now, please suggest me a simple POST method and PHP script that works.
Thanks.