Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Asadujjaman
#30267 (using arduino uno, esp8266, Arduino 1.6.5 sketch)

I am trying to send GET request through AT command, here are my commands bellow;

AT+CWJAP="*******","*******"

AT+CIPSTART="TCP","shotlu.usrs0.com",80

AT+CIPSEND=73 (length of the url)

>GET /receiver.php?apples=56&oranges=23 HTTP/1.1\r\nHost: shotlu.usrs0.com\r\n\r\n

*******************************/\******************************

But after sending the url it's giving me this message;

GET /receiver.php?apples=56&oranges=23 HTTP/1.1\r\nHost: shotlu.usrs0.com\r\n\r\nbusy s...

SEND OK

+IPD,168:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>hosting</center>
</body>
</html>

OK
CLOSED

OK

any guess why this happened?


******************************/\*********************************
I used this php code for saving data to a text file(basically "GET /receiver.php?apples=56&oranges=23 HTTP/1.1\r\nHost: shotlu.usrs0.com\r\n\r\n" it will hit this php file and after that this php file will update a Text file)

<?php

$var1 = $_GET['apples'];
$var2 = $_GET['oranges'];

$fileContent = "You have ".$var1." apples, and ".$var2." oranges.\n";
$fileStatus = file_put_contents('myFile.txt',$fileContent,FILE_APPEND);
if($fileStatus != false)
{
echo "success: data written to file";
}
else
{
echo "FAIL: could not write to file";
}
?>
User avatar
By Barnabybear
#30275 Hi, I'm not sure that "AT+CIPSEND=73 (length of the url)" is correct.
Code: Select allGET /receiver.php?apples=56&oranges=23 HTTP/1.1\r\nHost: shotlu.usrs0.com\r\n\r\n

I count as 81 characters - \r & \n only count as one each. There are 6 of them.
So 81 - 6 = 75
Try
Code: Select allAT+CIPSEND=75 (length of the url)