RE: [PHP] best function to use ~ file_get_contents or ?
| From: | Andrea Giammarchi | Date: | Wed, 16 Sep 2009 09:17:10 +0000 |
| Subject: | RE: [PHP] best function to use ~ file_get_contents or ? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298088@lists.php.net to get a copy of this message | ||
> The way I've always seen this approached before is by using the wget
> command, which can be asked to just return the headers for a page. In
> your case you'd be looking for all 200 codes, which means that all the
> sites are up. This is faster than asking to return a full image each
> time.
but slower 'cause for each image you need to requests
On the other hand, file_get_contents could return false positives cause the fact we are asking for
an image does not mean an image will be returned.
I would go for a curl call, where you can have both headers and content so in one call you can
handle every case. A bit slower than a HEAD request, surely faster than a HEAD request plus the
REQUEST.
One more thing, I hope you have rights to grab these images, usually there are APIs or webservices
when a website would like to share images in this way but it does not seem the case here ...
Regards
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx