Some servers support using the "HEAD" method in your request.  It will allow
you to check for the file without actually downloading the file.
Many server support 'if-modified-since' which can be used with an late
enough date to either get "unmodified" (file exists) or "not found"

It appears Zend_Http_Client can be used with both methods to check for a
file without actually downloading it.

On Thu, Jan 14, 2010 at 1:24 PM, Fred Jiles <[email protected]> wrote:

> Not a ZF way to do it, but you could use curl, and get the response.  If it
> can't find it, it will be 404, 200 on found.  Again this will only work if
> accessible via http request.
>
>
> On Thu, Jan 14, 2010 at 2:20 PM, Bruno Fajardo <[email protected]>wrote:
>
>> 2010/1/14 JoostV <[email protected]>
>> >
>> > I need to check whether an image exists on a remote server. Anybody got
>> any
>> > quick pointers?
>> >
>> > if (file_exists($file) && is_file($file)) {
>> > }
>> > only works for local files.
>>
>> Actually, as described in the PHP manual section for the file_exists
>> function (http://www.php.net/manual/en/function.file-exists.php), as
>> of PHP 5.0.0, this function can also be used with some URL wrappers,
>> including HTTP. The image on the remote server is accessible via
>> webserver?
>>
>> > --
>> > View this message in context:
>> http://n4.nabble.com/Check-if-an-image-exists-on-remote-server-tp1014172p1014172.html
>> > Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
>

Reply via email to