libcurl POST 登录失败,求救!!!

jngxx 2016-05-20 07:10:22
如题,我在linux里使用libcurl模拟邮件系统登录,为什么一直都登录不进去呢?
返回的页面Body能看到提示,帐号或密码错误!!!
CURL* curl = curl_easy_init();

struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, headerData);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, “username=wang123&password=123456&language=zh_CN&enter=true”);
curl_easy_setopt(curl,CURLOPT_COOKIEFILE,"/tmp/cookie.txt");
curl_easy_setopt(curl,CURLOPT_COOKIEJAR, "/tmp/cookie.txt");

curl_easy_setopt(curl, CURLOPT_URL, “http://mail.***.com.cn:8001/webmail/index.php?module=operate&action=login”);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_easy_perform(curl);

我使用curl就可以./curl --data "username=wang&password=123456&language=zh_CN&enter=true" -X POST "http://mail.***.com.cn:8001/webmail/index.php?module=operate&action=login"


用tcpdoump抓包后看到POST数据是正确发出了的

...全文
157 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
linranguo 2016-05-25
  • 打赏
  • 举报
回复
headerData是什么数据,可能是header部分的问题

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧