卷曲不写cookie和http代码404,为什么?

时间:2013-11-04 14:51:38

标签: cookies curl

我想卷曲饼干 cookie文件已创建但是为空,为什么? 而agent_http_code值:404,为什么? 感谢。

$url ="https://example.com";
$xmlfile = '/home/*******/public_html/2.xml';
$cookie_file = '/home/******/public_html/cookie.txt';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('action-xmlagentxmlfile'=>'@' . $xmlfile));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
if (file_exists($cookie_file) && filesize($cookie_file) > 0) {
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
}

0 个答案:

没有答案