ESP8266,ARDUINO->PHP->SQL

Dear all

with the help of this forum i managed to send data to my sql database (https://forum.arduino.cc/index.php?topic=464586.0) using an ethernet shield. Im now trying to do the same thing using a esp8266 esp-01 module. At this point im just trying to send a data string to my php and i know I`m missing something. Here is the code:

#include "SoftwareSerial.h"

String ssid ="Rafina";
String password="4112703241";

SoftwareSerial esp(2, 3);// RX, TX

String server = "192.168.42.21"; // www.example.com
String uri = "/writeSql.php?";// our example is /esppost.php
String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";
String temp= "100";
String hum= "100";
String data = "temp1=" + temp + "&hum1=" + hum;// data sent must be under this form //name1=value1&name2=value2.
String postRequest = "GET " + uri + data + " HTTP/1.1 \r\n" + "Host: 192.168.42.21 \r\n" + "Content-Type: application/x-www-form-urlencoded \r\n" + "Connection: close \r\n"; 

void setup() {

esp.begin(9600);
Serial.begin(9600);
}

void loop () {

esp.println("AT+RST");
Serial.println("AT+RST");
delay(1000);
esp.println(cmd);
Serial.println(cmd);
delay(4000);

esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.
Serial.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");

esp.println("AT+CIPSEND=");
Serial.println("AT+CIPSEND=");

esp.print(postRequest);
Serial.print(postRequest);

esp.println(" HTTP/1.1");
Serial.println(" HTTP/1.1");

esp.println("Host: 192.168.42.21" );
Serial.println("Host: 192.168.42.21" );

esp.println("Content-Type: application/x-www-form-urlencoded" );
Serial.println("Content-Type: application/x-www-form-urlencoded" );
esp.println( "Connection: close" );
esp.println( "Connection: close" );

esp.print("AT+CIPCLOSE");
Serial.println("AT+CIPCLOSE");



delay(100000);
}

It does not work! What is missing?

Hi all,

I`m trying to send data to my php script and then to my sql database using the AT commands on the serial monitor. I have managed to send data using my Ethernet shield, as described here, https://forum.arduino.cc/index.php?topic=464586.0 , and now I'm trying to adapt the code on my esp8266.

So this is the Ethernet shield code that I want to alter:

if (client.connect(server,80)) { // REPLACE WITH YOUR SERVER ADDRESS
    Serial.println("Connected");
 client.print("GET /writeSql.php?"); 
    Serial.print("GET /writeSql.php?");
    client.print("temp1=");
    Serial.print("temp1=");
    client.print(t);
    Serial.print(t);
    client.print("&hum1=");
    Serial.print("&hum1=");
    client.print(h);
    Serial.print(h);
   
    client.println(" HTTP/1.1");
    Serial.println(" HTTP/1.1");
    client.println("Host: 192.168.42.21" );
    Serial.println("Host: 192.168.42.21" );
    client.println("Content-Type: application/x-www-form-urlencoded" );
    Serial.println("Content-Type: application/x-www-form-urlencoded" );
    client.println( "Connection: close" );
    Serial.println( "Connection: close" );
    client.println();
    Serial.println();
    client.println();
    Serial.println();
 } 
  client.stop();  // DISCONNECT FROM THE SERVER
  Serial.println("Client Stop");

}

and this is what commands I use on the ESP8266 serial monitor:

AT+RST


OK
4,CLOSED
H!�΅Ρ!§�
1όF
�)�ξζΉ* •(H~� C΅¥µThinker Technology Co. Ltd.

ready
AT+GMR

AT version:0.21.0.0
SDK version:0.9.5

OK
AT+CWMODE=1


OK
AT+CWJAP="Rafina","4112703241"


OK
AT+CIPMUX=0


OK
AT+CIFSR

+CIFSR:STAIP,"192.168.42.164"
+CIFSR:STAMAC,"18:fe:34:a0:c0:27"

OK
AT+CIPSTART="TCP","192.168.42.21",80

CONNECT

OK
AT+CIPSEND=134


OK
> GET /writeSql.php?temp1=100&hum1=100 HTTP/1.1  Host: 192.168.42.21  Content-Type: application/x-www-form-urlencoded  Connection: close
busy s...

SEND OK
AT+CIPSTATUS

STATUS:3
+CIPSTATUS:0,"TCP","192.168.42.21",80,0

OK
AT+CIPCLOSE

CLOSED

OK

Unfortunately no data are send to my sql. Is something missing? Thank you all!!

@bitaris, please do not cross-post. Mess cleansed.