I am totally new to php coding and also fsockopen command.
Through Telnet i am able to access my host at 192.168.0.150 10001(port)
Now i need to access the device(same host) through php fsockopen. i need to store the output to a variable and want to apply some calculation on that variable.
below is the coding i am using and error i am getting
<?php
$fp = fsockopen("192.168.0.150", 10001, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: 192.168.0.150\r\n";
$out .= "Connection: Close\r\n\r\n";
echo $out;
echo $fp;
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
when i open this php file in my xampp local server i am getting below error.
Error message in browser
GET / HTTP/1.1 Host: 192.168.0.150 Connection: Close Resource id #22.60 2.59 2.60 2.59 2.60 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.60 2.59 2.60 2.59 2.59 2.59 2.59 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.59 2.59 2.60 2.59 2.59 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.60 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.60 2.60 2.59 2.60 2.59 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.60 2.60 2.60 2.60 2.59 2.60 2.60 2.59 2.60 2.60 2.60 2.60 2.59 2.60 2.59 2.59 2.60 2.60 2.59 2.60 2.60 2.59 2.60 2.60 2.60
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\c.php on line 13