Hello to all.
I have a problem with "fopen".
I want to control that the time of duraccion of they fopen is not superior to X seconds.
I am tried It with "set_time_limit" but it does not leave to me.
Something is happened to you. Thanks
problems with fopen
Moderator: General Moderators
problems with fopen
I have a function in which I must send a series of different information to url´s.
The problem is that when doing one fopen(http://xxx.xxx.xxx.xxx:80/prueba.php),
if the server takes long time in responding, slows down all the process to me.
What wanted is to give timeout to fopen it .
Thanks.
The problem is that when doing one fopen(http://xxx.xxx.xxx.xxx:80/prueba.php),
if the server takes long time in responding, slows down all the process to me.
What wanted is to give timeout to fopen it .
Thanks.
fsockopen
Maybe the function u need is fsockopen and not fopen.
With this function you have to sendout the GET headers yourself.
Some more work, but i think there are lots of examples.
Like from php.net
With this function you have to sendout the GET headers yourself.
Some more work, but i think there are lots of examples.
Like from php.net
Code: Select all
<?php
$fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>