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

Hi

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.. mydomain.com/mydatapage.php?authcode=111&dataOne=111&dataTwo=111

I tryed using

AT+CIPSTART="TCP","mydomain.com/mydomain.com/mydatapage.php?authcode=111&dataOne=111&dataTwo=111", 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…
but

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

GMR
CWMODE=1
CIPMUX=1
CWJAP=<SSID>,<password>

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

CIPSTART=1,"TCP","www.mydomain.com",80      //  1 is connection 1, port 80 
CIPSEND=1,stringLength                       //   1 is connection again, 

/mydatapage.php?authcode=xxx&dataOne=1111&dataTwo=111\r\n\r\n

It returns this

SEND OK

+IPD,1,274:

404 Not Found

Not Found

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


Apache Server at default Port 80

OK

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.


Imgur

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

AT+CWJAP="mywifirouterID","mywifipassword"
-- wait for ok response

website connection + data transmission

AT+CIPSTART="TCP","mywebsite",port80
-- wait for ok response

AT+CIPSEND=theLengthOfTheEntireCommandWithDomainAndEnding
-- 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.
AT+CIPCLOSE

my website code

<?php

    echo 'Just testing';

    require_once 'forbindelse.php';
    connect();

    $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 :

Imgur

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