使用cURL下载的图像显示为空

时间:2014-11-12 12:39:17

标签: php image curl

使用cURL下载图像时遇到问题。图片下载了它的空白

$ch = curl_init('http://cdn.cnetcontent.com/08/64/0864d554-c63a-4bbe-9e0b-5f65d778412b.jpg');
$fp = fopen('/var/www/clients/client1/web5/web/img-cnet/' . basename('http://cdn.cnetcontent.com/08/64/0864d554-c63a-4bbe-9e0b-5f65d778412b.jpg'), 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
$output = curl_exec($ch);
print_r($output);
print_r(curl_version());
curl_close($ch);
fclose($fp);

我想也许我尝试下载图片的网站不允许使用脚本。什么可能是错的?

提前致谢

编辑:cURL给我的错误就是这个

      * Protocol  http not supported or disabled in libcurl

但是在协议中使用curl_version()会说http

[version_number] => 465408
[age] => 3
[features] => 50813
[ssl_version_number] => 0
[version] => 7.26.0
[host] => x86_64-pc-linux-gnu
[ssl_version] => OpenSSL/1.0.1e
[libz_version] => 1.2.7
[protocols] => Array
    (
        [0] => dict
        [1] => file
        [2] => ftp
        [3] => ftps
        [4] => gopher
        [5] => http
        [6] => https
        [7] => imap
        [8] => imaps
        [9] => ldap
        [10] => pop3
        [11] => pop3s
        [12] => rtmp
        [13] => rtsp
        [14] => scp
        [15] => sftp
        [16] => smtp
        [17] => smtps
        [18] => telnet
        [19] => tftp
    )

0 个答案:

没有答案