How to use php file_get_contents with ESP8266 A part of my project need to get datas from an ESP8266 with php script. I tested this script and i don't know why i can get the datas in an iframe element and nothing with file_get_content function. In iframe element my browser displayes "Hello my friend!" as wanted:

The ESP8266 server mode at 192.168.4.1 address, part of code:

String webpage = "&lt;div id='div1'&gt;Hello&lt;/div&gt;";
webpage += "&lt;div id='div2'&gt;my&lt;/div&gt;";
webpage += "&lt;div id='div3'&gt;friend!&lt;/div&gt;";

String cipSend = "AT+CIPSEND=";
cipSend += 0;
cipSend += ",";
cipSend +=webpage.length();
cipSend +="\r\n";

sendData(cipSend,1000,DEBUG);
sendData(webpage,1000,DEBUG);
sendData("AT+CIPCLOSE=0\r\n", 100, DEBUG);


The php script:

&lt;html&gt;
    &lt;body&gt;
    &lt;iframe src="http://192.168.4.1/?cmd=SS,0,0,"&gt;&lt;/iframe&gt;

 &lt;?php

 $url="http://192.168.4.1/?cmd=SS,0,0,";
 $lines_string = file_get_contents($url);
 echo htmlspecialchars($lines_string);

?&gt;
    &lt;/body&gt;
&lt;/html&gt;


If i replace the url by:

$url=https://arduino.stackexchange.com


It works with php script,so what is the issue with the ESP8266 ?
To process the request by php, you must send valid HTTP response. The browser tolerates too much.

String webpage = "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n";
webpage += "&lt;div id='div1'&gt;Hello&lt;/div&gt;";