ESP8266 Post data to a website/sql db - [SOLVED]


Got a ESP8266 type -05 hooked up to a Mega. All AT commands checks out ok.

Using the arduino as a relay, im able to - Connect to the localnetwork OK - change modes OK All checks out,

Im trying to make the arduino send a string to a domain where i allready have a php page setup that uses "GET" to grab info and store it.

The problem is getting the data from my arduino to the server.

i want to send this example..

I tryed using

AT+CIPSTART="TCP","", 80 it returns "Link typ ERROR"

Also tryed AT+CIPSEND,, but ofcourse that requires CIPSTART first..

Does anyone have any suggestions ? Thank you.

EDIT: I only want to send data, not interested in receiving or viewing in this case.

Ahh i think i solved it…

Will look more into it tomorrow…

steps i do atm… ALL with AT+ infront ofcourse…


prepare my data string, and count the length..
then i connect to the site..

CIPSTART=1,"TCP","",80      //  1 is connection 1, port 80 
CIPSEND=1,stringLength                       //   1 is connection again, 


It returns this



404 Not Found

Not Found

The requested URL /mydatapage.php was not found on this server.

Apache Server at default Port 80


So i might just have to rework my linking to the php page… :wink:

More tomorrow, where i exspect to get this working.

Well solved my problem today, infact it was more simple than expected.
Thanks to this site, all the commands are explained. except im missing some,
using an older firmware from 2012-13 ish… still works without updating.

At command set.


Next is to implement this into arduino code :wink: should be straight forward, using a mega :wink:

initial wifi connection

AT                       // check if alive
AT+CWMODE=1    // SET mode
AT+RST               //  reset
-- wait for system ready

-- wait for ok response

website connection + data transmission

-- wait for ok response

-- wait for >  response

when i see >   i type

GET http://mywebsite/somepath/somepage.php?instructionsHTTP/1.0\r\n\r\n\r\n   
-- HTTP/1.0 must be connected to your link without space.
-- \r\n  is enter or line break across multiple systems
-- wait for SEND OK

-- If it does not unlink automatically i need to.

my website code


    echo 'Just testing';

    require_once 'forbindelse.php';

    $Dato = $_GET['dtg'];
    $Ldr = $_GET['ldr'];

    $query = "INSERT INTO LDR (dtg, ldr) VALUES ('" . $Dato . "', '" . $Ldr . "')";
    $result = mysql_query($query) or die('Error : ' . mysql_error());

result in databse :


now i can manipulate the data on websites etc :wink:

please send me the complete code for Post data to a website/sql db using arduino mega