fsockopen Fatal error: Maximum execution time of 30 seconds exceeded

Hi everyone,

I am trying to use the fsockopen method to connect to server.

the code is following:

<? $httpbody = "testing"; $out = "POST $remotepath HTTP/1.1\r\n"; $out .= "Host:$remoteserver \r\n"; $out .= "Authorization: Basic \r\n"; $out .= "content-length: ".strlen($httpbody)." \n\n"; $out .= $httpbody; $fp = fsockopen("$remoteserver",80); if ($fp) { fputs($fp, $out); while (!feof($fp)) { echo fgets($fp); } fclose($fp); } else { echo "Connect Failure
"; } ?>

However, I got the error message as : "Fatal error: Maximum execution time of 30 seconds exceeded in line 20. In the line 20 is “echo fgets($fp);”.

Questions:
Is the fsockopen able to connect to remote server? It should be yes, right? because it execute the if ($fp). So what is this error message referring to?

Thanks for your help guys.

REgards,

Chupiter