使用cURL远程登录 - 未找到cookie

时间:2017-05-13 14:46:59

标签: php curl cookies

我正在尝试使用以下代码进行远程登录:

$cookiefile = dirname(__FILE__)."/cookie.txt" ; 
$postData = array(
    '&email' => 'email',
    '&pwd' => 'password',
   // 'redirect_to' => 'http://example.com',
   // 'testing_cookie' => '1'
);
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => 'https://exaple.com/login?cid=6',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $postData,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_COOKIESESSION => true,
    CUROPT_COOKIEJAR => $cookiefile,
    CURLOPT_COOKIEFILE=> $cookiefile
));

$output = curl_exec($ch);
echo $output;

我收到错误 - 找不到Cookie -

抱歉,您的浏览器似乎不接受我们网站的Cookie。 Cookie是存储在浏览器中的个人识别所需的小型数据包

更新: 此外,我也得到如下错误:

Notice: Use of undefined constant CUROPT_COOKIEJAR - assumed 'CUROPT_COOKIEJAR' in E:\wamp\www\remote-curl\curl_request.php

0 个答案:

没有答案
相关问题