标题:libcurl 获取到的 cookie 不全
只看楼主
jsjseo
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-6-14
结帖率:0
 问题点数:0 回复次数:0 
libcurl 获取到的 cookie 不全
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

        headerlist = curl_slist_append(headerlist, "Host:sellercentral.);
        headerlist = curl_slist_append(headerlist, "Connection:keep-alive");
        headerlist = curl_slist_append(headerlist, "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
        headerlist = curl_slist_append(headerlist, "User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36");
        headerlist = curl_slist_append(headerlist, "Referer:https://sellercentral.*Version*=1&*entries*=0&");
        headerlist = curl_slist_append(headerlist, "Cache-Control:max-age=0");
        //headerlist = curl_slist_append(headerlist, "Accept-Encoding:gzip,deflate,sdch");
        headerlist = curl_slist_append(headerlist, "Accept-Language: zh-CN,zh;q=0.8,en;q=0.6");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
        curl_easy_setopt(curl, CURLOPT_URL, "https://sellercentral.);
        curl_easy_setopt(curl, CURLOPT_POST, 0L);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, call_wirte_func);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &szbuffer);
        curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "D:\\cookie_open.txt");//把服务器发过来的cookie保存到cookie_open.txt
#ifdef SKIP_PEER_VERIFICATION
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
#ifdef SKIP_HOSTNAME_VERFICATION
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
#endif
        
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
         curl_slist_free_all(headerlist);

获取到的cookie只能获取到2条
搜索更多相关主题的帖子: Windows cookie 
2014-06-17 14:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-433037-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.188328 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved