Using curl, without download content, remote image valid can be known.
Example:
$url = "http://www.example.com/image.jpg"; 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); if(curl_exec($ch)!==FALSE) { return true; } else { return false; } curl_close($ch); }
Output: false
What do you think?