2011-09-21 62 views
0

这是我的卷曲功能:试图卷曲获得的图像,但我得到奇怪的结果

function curl($url) { 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_VERBOSE, 0); 
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;  SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'picturecookies.txt'); 
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/"); 
curl_setopt($ch, CURLOPT_URL, $url); 
$return = curl_exec($ch); 
return $return; 
} 

的示例图像IM试图让:

http://static.fjcdn.com/large/pictures/39/29/3929d8_2637027.jpg

当我尝试获取图像与卷曲,我只收到随机文件大小的文件每次。 heres连续返回6次的字节列表;

12 654 
12 627 
12 632 
12 632 
12 583 
12 627 

的示例图像是655KB

我到底做错了什么?

编辑:

我找到了原因:> 的图像是盗链保护。 它只是通过将引用者更改为呈现图像的url来解决。

回答

1

您可能重新注意到funnyjunk索引页面而没有注意到;-)