ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am using the file() function in PHP to grab the source of a URL. The problem I am having is that every once in a while file() will randomly fail to open the URL and throw a "failed to open stream" error. Is there a simple way I can check for this and retry the file() function if it does fail?
Returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. Upon failure, file() returns FALSE.
But obviously, if I ever did get a bad URL, it would be in an endless loop.
pafinator11, your solution solves that problem quite well. I thank all you guys for your help! I can always count on the community here!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.