Jean-Arthur Silve wrote:
Hi !
I use the file function for accessing to pages on another server.
It works perfectly.
But if the server does not respond or is too long to send datas, the file
function wait too long..
Is there a way to tune the time out ?? I would like that id the
from the manual
?php
$fp = fsockopen(www.php.net, 80);
if(!$fp) {
echo Unable to open\n;
} else {
fputs($fp,GET / HTTP/1.0\n\n);
$start = time();
socket_set_timeout($fp, 2);
$res = fread($fp, 2000);
//var_dump(socket_get_status($fp));
fclose($fp);
print $res;
}
?
Jean-Arthur,
Your set_time_limit/shutdown function solution looks like a clever
trick. If you can come up with that you might just as well do the
proper job with an fsockopen and socket_set_timeout.
The manual pages on fsockopen, socket_set_timeout plus the user comments
have plenty of useful
3 matches
Mail list logo