Re: fetch html-page without file()

From: Date: Fri, 12 Jan 2001 11:07:47 +0000
Subject: Re: fetch html-page without file()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34225@lists.php.net to get a copy of this message
Hi mailing_list! On Fri, 12 Jan 2001, mailing_list@gmx.at 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

« previous php.general (#34225) next »