The use of the ESP8266 in the world of IoT

User avatar
By Lef
#62276 Hello guys, after 3 days of struggling I decided to ask for some help.
I have my ESP-01 connected to a USB-to-TTL converter and I send the commands through Terminal (by bray).
What I want to do is to put the esp-01 into client mode then connect to pushingbox and finally send a GET request with my deviceID (API) to pushingbox. Then a notification will come to my android through my newtifry account.

I have tested the pushingbox scenarios from my PC and newtifry notifications comes to my android as expected.
Also when I type the url with my deviceID ( http://api.pushingbox.com/pushingbox?de ... xxxxxxxxxx ) in the address bar it works fine.

BUT when I try to do the same thing with esp-01, when I send the get request i receive a... 400 Bad request (Your browser sent an invalid request). I changed the GET request format several times but nothing works.

I believe that the GET request I send is incomplete somehow but I cannot figure out what is missing.

Note: Terminal doesn't recognize \r and \n as single byte characters ( so \r\n = 4 bytes ===> one for each character \ r \ n). So the URL string I send is the number of URL characters + 4 bytes for every \r\n in the string.
For example if the URL string is 88 characters (bytes) long with \r\n\r\n in the end I add 8 characters.

Below I display the exact sequence of commands I send everytime and also the different versions of the GET request I have tried to send so far with no success.

Thank you for your time and help
==================================================
AT+CWMODE=1
AT+CWJAP="SSID","pswd"
AT+CIPSTART="TCP","api.pushingbox.com",80
AT+CIPMODE=0
AT+CIPSEND= number of characters of the GET request (bytes)

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\nConnection: close\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\nUser-Agent: ESP\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n :(

GET http://api.pushingbox.com/pushingbox?de ... xxxxxxxxxx HTTP/1.0\r\n\r\n :(

GET http://api.pushingbox.com/pushingbox?de ... xxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\nConnection: close\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.0\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.0\r\nConnection: close\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\nUser-Agent: ESP\r\nConnection: close\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\nUser-Agent: ESP\r\nConnection: close\r\nContent-Type: text/html :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\nHost: api.pushingbox.com\r\n\r\n :(

GET /pushingbox?devid=xxxxxxxxxxxxx HTTP/1.1\r\n\r\nHost: api.pushingbox.com\r\n\r\n :(

GET http://api.pushingbox.com/pushingbox?de ... xxxxxxxxxx HTTP/1.0\r\n\r\n\r\n :(