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 = "<div id='div1'>Hello</div>";
webpage += "<div id='div2'>my</div>";
webpage += "<div id='div3'>friend!</div>";
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:
<html>
<body>
<iframe src="http://192.168.4.1/?cmd=SS,0,0,"></iframe>
<?php
$url="http://192.168.4.1/?cmd=SS,0,0,";
$lines_string = file_get_contents($url);
echo htmlspecialchars($lines_string);
?>
</body>
</html>
If i replace the url by:
$url=https://arduino.stackexchange.com
It works with php script,so what is the issue with the ESP8266 ?