有一個CURL功能,我一直用來從URL獲取圖像並將其保存到m服務器,因爲COPY()從我的主機被禁用。
我經過是URL $ 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($網址)輸出
過程中的資源ID#7
警告:curl_setopt()預計參數1是資源,在 警告空給出:curl_errn o()期望參數1是資源,null給出
請幫忙!
感謝您的回答..你是正確的..我已經使用CURL在兩個不同的功能用於不同的目的和粘貼時,我忘記了替換這一個變量... – Jay66online