note 95923 deleted from function.file-get-contents by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Jan 2010 23:41:54 +0000 |
| Subject: | note 95923 deleted from function.file-get-contents by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165471@lists.php.net to get a copy of this message | ||
Note Submitter: magnets
----
Occasionally file_get_contents is unable to retrieve a web page. The quickest method I have
discovered to retrieve the same string is to use WGET to retrieve and store the file and then use
file_get_contents to retrieve that stored file.
$input = file_get_contents($url);
if(!$input) {
exec 'wget $url -O ' . $filename;
$input = file_get_contents($filename);
}