@Michael,

Thanks, Zend_Http_Client works!

I try to do a request and catch the exception if no connetction could be
made. Then I check the Content-type header to detemine if thsi is an image.

<?php
$image = 'http://static.php.net/www.php.net/images/php.gif';
$client = new Zend_Http_Client($image);

try {
    $response = $client->request();
    $headers = $response->getHeaders();
    if (isset($headers['Content-type']) && stristr($headers['Content-type'],
'image')) {    
        // Image exists - do something
    }
    throw new Zend_Exception('URL  ' . $image . ' ' . $image . '  is not an
image. Try another URL, please.');
}
catch (Zend_Http_Client_Adapter_Exception $e) {
    throw new Zend_Exception('URL  ' . $image . ' ' . $image . '  does not
exist. Try another URL, please.');
}
-- 
View this message in context: 
http://n4.nabble.com/Check-if-an-image-exists-on-remote-server-tp1014172p1014694.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to