<?
$p="http://news.cnhubei.com/hbrb/hbrbsglk/hbrb01/200905/W020090504254969587296.jpg";
$t_url ="http://news.cnhubei.com/hbrb/hbrbsglk/hbrb01/200905/t662541.shtml";$rs = file_get_pic($p);
echo $rs;function file_get_pic($str) {
global $url_domin,$t_url;
$ch = curl_init(); 
//echo "<BR>".$from_url;
curl_setopt($ch, CURLOPT_URL, $str);  
curl_setopt($ch, CURLOPT_HEADER, 0);            //返回内容中包含 HTTP 头 
//curl_setopt($ch,CURLOPT_POST,1);         $useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; QQDownload 1.7; TencentTraveler 4.0";
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

curl_setopt($ch, CURLOPT_REFERER, $t_url);
curl_setopt($ch,CURLOPT_COOKIESESSION,true); 
//curl_setopt($ch,CURLOPT_COOKIE,"hiido_lv=1241423490703&hiido_ti=1241425695046&hiido_tod=4&hiido_ui=0.14425078706025363"); 
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
//echo $t_url;
$str = curl_exec($ch);                        
curl_close($ch); 
return $str;
}?>上述代码,有时成功。有时不成功。不知什么原因?