Arduino retrieving PHP echo using ESP8266 I want to retrieve the echo string. Here is my php code

&lt;?php
    echo "&lt;hello word!&gt;";
?&gt;


I am using ESP8266 and Arduino Uno. I have managed to send the request but it's not returning the string from my php file. Any idea where i went wrong with my code? Thanks in advance

#include &lt;SoftwareSerial.h&gt;
#include &lt;Ethernet.h&gt;
#include &lt;SPI.h&gt;

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

String ssid ="";  
String password="";     

String server = "http://domain.com/";
String location = "/retrieveInfo.php";

char inString[32]; // string for incoming serial data
int stringPos = 0; // string index counter
boolean startRead = false; // is reading?

void setup()
{
    esp.begin(9600);
    Serial.begin(9600);
    connectWifi();
}

void loop()
{
  String pageValue = connectAndRead(); //connect to the server and read the output
  Serial.println(pageValue); //print out the findings.
  delay(5000); //wait 5 seconds before connecting again
}

String connectAndRead()
{
  //connect to the server
  Serial.println("Connecting...");
    String cmd2 = "AT+CIPSTART=2\"TCP\",\"" + server + "\",80";
    esp.println(cmd2);
    delay(4000);

    if (esp.find("OK"))
      {
        Serial.println("TCP Connection Ready.");
      }
             String postRequest = "GET" + location + "HTTP/1.0\r\n";
             String cmd4 = "AT+CIPSEND=2,80";
             delay(4000);
             esp.println(cmd4);
             esp.println(postRequest.length());
             delay(4000);

             if (esp.find("&gt;"))
                {
                   Serial.println("Sending...");
                   delay(1200);
                   esp.println(postRequest);
                   esp.println();

                  if (esp.find("SEND OK"))
                  {
                    Serial.println("Packet sent");
                    Serial.println();
                    delay(4000);
                    //Connected - Read the page
                    return readPage(); //go and read the output

                 }
                  else
                  {
                    Serial.println("Connection failed");
                  }
            }
    else
      {
        Serial.println("TCP Connection Not Ready.");  
      }
}

String readPage()
{
  //read the page, and capture &amp; return everything between '&lt;' and '&gt;'

  stringPos = 0;
  memset( &amp;inString, 0, 32 ); //clear inString memory

  while(true)
  {
      if (esp.available()) 
        {
          char c = esp.read();
          if (c == '&lt;' ) { //'&lt;' is our begining character
            startRead = true; //Ready to start reading the part 
          }else if(startRead){

            if(c != '&gt;'){ //'&gt;' is our ending character
              inString[stringPos] = c;
              stringPos ++;
        }
        else
          {
            //got what we need here! We can disconnect now
            startRead = false;
            return inString;

         }

      }
    }

  }
}

void connectWifi()
  {

    String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"\r\n";
    esp.println(cmd);
    delay(5000);

    if(esp.find("OK"))
      {
        Serial.println("Connected!");
        delay(4000);
        enableconn();
        delay(1000);
      }

    else
      {
        Serial.println("Cannot connect to wifi");
        connectWifi();
      }

  }

void enableconn()
  {
    String cmd1 = "AT+CIPMUX=1";
    esp.println(cmd1);
    delay(4000);
    if (esp.find("OK"))
      {
      Serial.println("Ok");
      delay(4000);
      connectAndRead();
      }
     else
      {
        Serial.println("Cannot enable multiple connections");
      }
  }


for some reason, the line "return readPage();" isn't returning any value. Any heads up would be much appreciated. This is my output in the serial monitor
It looks like you post request may be missing a CRLF at the end (it needs two) and some spaces.

I think you need this:

 String postRequest = "GET " + location + "\r\nHTTP 1.0\r\n\r\n";


My suggestion would be to get a REST client (like the one you can get for Chrome as an App) and send the message to your server through that and see what the difference is.