Php 试图卷曲图像,但我得到了奇怪的结果

Php 试图卷曲图像,但我得到了奇怪的结果,php,curl,Php,Curl,这是我的旋度函数: 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.37

这是我的旋度函数:

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;
}
我正在尝试获取的示例图像:

当我尝试使用curl获取图像时,每次只能得到一个随机文件大小的文件。 这是一个连续返回6次的字节列表

12 654
12 627
12 632
12 632
12 583
12 627
示例图像为655kB

我做错了什么

编辑:

我发现了原因:> 图像受热链接保护。
只需将referer更改为显示图像的url即可解决此问题。

您可能会被重定向到funnyjunk索引页,而没有注意到;-)