note 32176 rejected from function.stream-set-timeout by spic
| From: | spic@php.net | Date: | Mon, 19 May 2003 18:10:11 +0000 |
| Subject: | note 32176 rejected from function.stream-set-timeout by spic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48603@lists.php.net to get a copy of this message | ||
Note Submitter: kesl@softhome.net
----
this thing isnt working at all or i am so dumb!
i created y.php which only echoes one string and waits 7 sec. why doesnt this x.php [below] finish
in 3 sec? it should! instead of 3, it finishes in 7 what means timeout is not working.
<?
define("cTIMEOUT", 3);
define("cHOST", "velenje.com");
$xSocket = fsockopen(cHOST, 80, $errno, $errstr, cTIMEOUT);
socket_set_blocking($xSocket, 1);
socket_set_timeout($xSocket, cTIMEOUT, 0);
fputs($xSocket, "GET /y.php HTTP/1.0\r\nHost: " . cHOST . "\r\n\r\n");
while (!feof($xSocket))
{
$x = fread($xSocket, 3000);
}
echo "*** DONE ***";
?>