我一直在使用 CURL 功能从 url 获取图像并将其保存到 m 服务器,因为 COPY() 已从我的主机中禁用。
我传递的网址是 $url=http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/People_from_Switzerland.png/285px-People_from_Switzerland.png
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$userAgent = 'php';
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $useragent);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
当我尝试回显 curl_init($url) 输出时出现以下错误
进程资源 id #7
警告:curl_setopt() 期望参数 1 是资源,在
警告中给出 null :curl_errno() 期望参数 1 是资源,在中给出 null
请帮忙!