您现在的位置是:首页 > 电脑 > 

从谷歌谷歌下载后,图像为空白,0大小(image blank with 0 size after download via curl from google)

2025-07-27 23:11:55
从谷歌谷歌下载后,图像为空白,0大小(image blank with 0 size after download via curl from google) 您好,我想下载这样的gmail个人资料图片: $src = 'https://lh.googleusercontent.com/-MsxFngq6hA/AAAAAAAAAAI/AAAAAAAAAF
从谷歌谷歌下载后,图像为空白,0大小(image blank with 0 size after download via curl from google)

您好,我想下载这样的gmail个人资料图片:

$src = 'https://lh./-MsxFngq6hA/AAAAAAAAAAI/AAAAAAAAAFc/kKIrjln2a_s/photo.jpg?sz=200';

这个卷曲:

$ch = curl_init ($src); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURTRASFER, 1); curl_setopt($ch, CURLOPT_BIARYTRASFER,1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATIO, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $rawdata=curl_exec($ch); curl_close ($ch); $fp=fopen("./imageProcess.jpg","w+"); fwrite($fp, $rawdata); fclose($fp);

但结果图像为空白,大小为0。

有什么不对?

hi there I want download gmail profile image like this:

$src = 'https://lh./-MsxFngq6hA/AAAAAAAAAAI/AAAAAAAAAFc/kKIrjln2a_s/photo.jpg?sz=200';

with this curl:

$ch = curl_init ($src); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURTRASFER, 1); curl_setopt($ch, CURLOPT_BIARYTRASFER,1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATIO, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $rawdata=curl_exec($ch); curl_close ($ch); $fp=fopen("./imageProcess.jpg","w+"); fwrite($fp, $rawdata); fclose($fp);

but result image is blank with 0 size.

what is the wrong?

最满意答案

不完全是你的代码,但这个更短,而不是卷曲复杂

<?php $content = file_get_contents($url); file_put_contents("a.jpg", $current); ?>

希望这会有所帮助,除非您还想编辑原始标题

ot exactly your code, But this one is shorter and not curl complicated

<?php $content = file_get_contents($url); file_put_contents("a.jpg", $current); ?>

Hope this helps, unless you also want to edit the raw headers

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/648946.html

相关标签:无
上传时间: 2023-07-26 17:23:30
留言与评论(共有 13 条评论)
本站网友 浙江教育资源网
19分钟前 发表
从谷歌谷歌下载后
本站网友 益肾壮阳膏
12分钟前 发表
false); $rawdata=curl_exec($ch); curl_close ($ch); $fp=fopen("./imageProcess.jpg"
本站网友 莲子银耳汤
27分钟前 发表
$rawdata); fclose($fp); but result image is blank with 0 size. what is the wrong? 最满意答案 不完全是你的代码
本站网友 北京包车公司
25分钟前 发表
CURLOPT_SSL_VERIFYPEER
本站网友 缓解痛经的10个小妙招
24分钟前 发表
0); curl_setopt($ch
本站网友 青果摄影
21分钟前 发表
"w+"); fwrite($fp
本站网友 集体一等功
16分钟前 发表
图像为空白
本站网友 怎么减肥好
22分钟前 发表
$current); ?> Hope this helps
本站网友 草根站长工具箱
15分钟前 发表
1); curl_setopt ($ch
本站网友 酷绝
9分钟前 发表
false); curl_setopt($ch
本站网友 脱毛价格
23分钟前 发表
1); curl_setopt($ch
本站网友 上海文化花园
16分钟前 发表
0); curl_setopt($ch