Hi mailing_list!
On Fri, 12 Jan 2001, [EMAIL PROTECTED] wrote:

> Hi!
> 
> Something strange:
> A script, that uses file("http://xyz.com") does work on one sever!
> Then I copied it to another server (physically more far away from the
> server from which I fetch the html-page with file()) - same PHP ...
> Now file() returns always an empty string (about in 1 try out of 1000 it
> is successful!!!! - I tested it!!)
> 
> Is there another method, to fetch a html-page?
> 
yap, fopen() the location, then test is the return code != false.

$tries = 3;

while (($fd = fopen("http://foo.bar","r")) == false && $tries) {
        sleep (4 - $tries);
        --$tries;
}
if (!$fd) die ("Page not available or server foo.bar is down");


-- teodor

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to