Wget或curl下载文件 - 对象移动错误302

时间:2013-12-02 12:57:05

标签: php curl wget

我更喜欢如果可以使用wget完成,否则更新我的curl代码。我搜索了很多,并尝试了许多建议的选项,如cookie,referer url,user-agent。 到目前为止,这是我的代码:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://www.symop.com/config/includes/common/dw.asp?PF=Publications&NF=symop_guide2013.pdf');
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6'); 
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($ch, CURLOPT_REFERER, "http://www.symop.com/fr/Publications.asp");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $html = curl_exec($ch);
    curl_close($ch);
    echo $html;

302对象已移动

0 个答案:

没有答案