Need a "retry" example with file()

From: Robert Oschler (no_replies_at_fake_email_address.invalid)
Date: 11/28/03


Date: Fri, 28 Nov 2003 21:04:13 GMT

I'm opening an RSS feed using the file() function with an "http://"
hyperlink as the argument for file(). If I run the PHP page that contains
the file() call, sometimes, fairly often in fact (%50), I get a "403:
Forbidden" error. If I hit the Reload button one or two times the function
succeeds and I receive the XML document.

I need an example of how to trap the error return from file() so I can enter
a retry loop with a 1 second wait value.

Can anyone point me to a good example?

BTW, I've noticed that when I enter the exact same URL I am using with the
file() function, into the address bar on Internet Explorer 6.0, it NEVER
returns an error message. Is IE simply hiding the error and automatically
executing a retry? Or is it possible they are requesting the document in a
manner more compatibile than that used with file() (which I find hard to
imagine). I'm wondering if this 403 error is really a 'busy' error.

Thanks.

--
Robert Oschler
http://www.dog-images.com -- Devoted to providing free info on the health,
nutrition, and training of dogs.

Quantcast