file_get_contents question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to write a simple bot that will go to links in a sitemap.
I have all the parser stuff done and everything works perfectly, the
spider can visit the pages. It always stops the script dead in its
tracks when it tries visiting a page that isn't there (404 or some
other error response) or the page takes way to long.

How would I go about adding something that will automatically skip the
url if there is a problem with it (either error or timeout)?

I really appreciate the help!

Riley S.

Re: file_get_contents question

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding wrote:
Quoted text here. Click to load it

Not sure what file_get_contents returns when it receives a 404 response, =
probably something like FALSE or NULL.

Could you clarify what you mean when you say "stops dead in its tracks"? =
the script freeze in an endless loop? Terminate with a PHP warning or err=

eternity lies ahead of us, and behind.
have you drunk your fill?
      *  *  *
AOL:  313125838 / cburschka

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -



Re: file_get_contents question


on 03/29/2009 02:38 AM said the following:
Quoted text here. Click to load it

I am not sure if it can be done with file_get_contents at all. You may
want to try this HTTP client instead that gives you full control of
timeouts and error handling.


Manuel Lemos

Find and post PHP jobs /

PHP Classes - Free ready to use OOP components written in PHP /

Site Timeline