How to hit my server with GET variables?
Posted: Tue Nov 10, 2015 5:20 am
Hi All
I am trying to do a very simple GET variablee "push" to a webserver from my Arduino/ESP8266.
I created a simple PHP script that runs on my public site - eg., www.mydom.com/arduino.php
The script on that page will look for two GET variables; var1, and var2, and when found, simply write it to a mysql DB. Thsi script works fine when hitting it directly from a browser, eg, www.mydom.com/arduino.php?var1=111&var2=222 -=> equates to a successful write to the DB.
What I cannot get right however is to do this via the ESP module and my Arduino sketch.
My Sketch generates some variables from a sensor, which I'm trying to then append to the variable values in the URL.
I have used a FOCA board for now to test, and trying to pass the AT commands never seem to "hit" the page.
Here is the sequence of AT commands I currently try:
{the module auto-connects to the AP, so I start after thhe module declares itself connected and that it received an IP}
AT+CIPSTART="TCP","mydom.com",80
{receive some indication that everything is fine}
AT+CIPSEND=132
{I then wait a while before sending the GET payload}
GET /arduino.php HTTP/1.1\r\nHost: http://www.dom.com\r\nUser-Agent: Mozilla/4.0\r\nContent-Length: 16\r\n\r\nvar1=111&var2=222
{here I typically see a "receiving 132 bytes", "rcv OK", and then after a while an OK and CLOSED. Also, the 132 characters used here will not necessarily add up in this example as I "sanitized" my real URL...}
The php script always echoes "Done!" regardless of what was sent to the URL in a browser.
1. I never see that on my terminal
2. There is nothing written to my DB
3. I cannot see this attempt in my Apache access logs.
Please could someone help me - why can I not seem to "hit" my script, yet I get indications from the module that everything *seems* to have worked?
I am trying to do a very simple GET variablee "push" to a webserver from my Arduino/ESP8266.
I created a simple PHP script that runs on my public site - eg., www.mydom.com/arduino.php
The script on that page will look for two GET variables; var1, and var2, and when found, simply write it to a mysql DB. Thsi script works fine when hitting it directly from a browser, eg, www.mydom.com/arduino.php?var1=111&var2=222 -=> equates to a successful write to the DB.
What I cannot get right however is to do this via the ESP module and my Arduino sketch.
My Sketch generates some variables from a sensor, which I'm trying to then append to the variable values in the URL.
I have used a FOCA board for now to test, and trying to pass the AT commands never seem to "hit" the page.
Here is the sequence of AT commands I currently try:
{the module auto-connects to the AP, so I start after thhe module declares itself connected and that it received an IP}
AT+CIPSTART="TCP","mydom.com",80
{receive some indication that everything is fine}
AT+CIPSEND=132
{I then wait a while before sending the GET payload}
GET /arduino.php HTTP/1.1\r\nHost: http://www.dom.com\r\nUser-Agent: Mozilla/4.0\r\nContent-Length: 16\r\n\r\nvar1=111&var2=222
{here I typically see a "receiving 132 bytes", "rcv OK", and then after a while an OK and CLOSED. Also, the 132 characters used here will not necessarily add up in this example as I "sanitized" my real URL...}
The php script always echoes "Done!" regardless of what was sent to the URL in a browser.
1. I never see that on my terminal
2. There is nothing written to my DB
3. I cannot see this attempt in my Apache access logs.
Please could someone help me - why can I not seem to "hit" my script, yet I get indications from the module that everything *seems* to have worked?