PHP check remote image valid using curl without download content

Using curl, without download content, remote image valid can be known.

$url = "";
echo check_remote_image($url);

function check_remote_image($url)
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL,$url);
    	// don't download content
    	curl_setopt($ch, CURLOPT_NOBODY, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    		return true;
    		return false;


Output: false

By Keenlio, May 20, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × = fifteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>