http://cn2.php.net/curl_setopt
<?php
$arr = array(
1 => 'http://app100625763-1.qzoneapp.com/pork13/data/feed/20140110/2967564.jpg',
2 => 'http://app100625763-2.qzoneapp.com/pork13/data/feed/20140110/2967564.jpg',
3 => 'http://app100625763-3.qzoneapp.com/pork13/data/feed/20140110/2967564.jpg',
4 => 'http://app100625763-4.qzoneapp.com/pork13/data/feed/20140110/2967564.jpg',
);
$result = 0;
foreach($arr as $k=>$v){
$ch = curl_init();
$timeout = 1;
curl_setopt($ch,CURLOPT_URL, $v);
curl_setopt($ch,CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
if(!preg_match("/404/", $contents)){
$result = $v;
break;
}
}
echo $result;
?>