Thanks msound for the inspiration. I didn`t think of checking the headers.
So i came up with a shorter, easier to understand version of the above.
$headerInfo = get_headers( $value['photo_file_url'], 1 );
if( $headerInfo[0] != "HTTP/1.1 200 OK" ){
// Do something
}
The get_headers function returns something like this:
Array
(
[0] => HTTP/1.1 200 OK
[Date] => Tue, 08 Apr 2014 14:40:33 GMT
[Content-Type] => image/jpeg
[Content-Length] => 326978
[Connection] => close
[P3P] => policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
[Cache-Control] => max-age=315360000,public
[Expires] => Sun, 10 Mar 2024 12:42:04 UTC
[Last-Modified] => Wed, 25 Jul 2012 20:40:58 GMT
[Accept-Ranges] => bytes
[X-Cache] => Array
(
[0] => HIT from photocache814.flickr.bf1.yahoo.com
[1] => HIT from cache414.flickr.ch1.yahoo.com
)
[X-Cache-Lookup] => Array
(
[0] => HIT from photocache814.flickr.bf1.yahoo.com:85
[1] => HIT from cache414.flickr.ch1.yahoo.com:3128
)
[Age] => 1561078
[Via] => 1.1 photocache814.flickr.bf1.yahoo.com:85 (squid/2.7.STABLE9), 1.1 cache414.flickr.ch1.yahoo.com:3128 (squid/2.7.STABLE9)
)