Jump to content

Dealing with file_get_contents errors?


python72

Recommended Posts

I am using file_get_contents to get file off the internet for  further processing but somtetimes there is error fetching that file off the web in which case it would be nice to try to reload it again but I am not sure what would be best way to do it? How can I jump back on error? I guess there would have to be some jump to label condition, but how do I implement this?

Link to comment
Share on other sites

If I have the following:

$Page = file_get_contents('http://www.google.com/');

The $Page variable would be null till the page loads completely?

Now using the while would I have the following?

$Page=Null;
while($Page == Null){
$Page = file_get_contents('http://www.google.com/');
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.