libcurl post数据

来源:互联网 发布:阿里云市场份额 编辑:程序博客网 时间:2024/04/27 19:21

libcurl post数据是经常用到的操作

以学校论文指导系统登录为例,网址:http://xxxy.hbmy.edu.cn/admin.php?mod=papers&file=index


抓包数据如下:



#include "stdafx.h"#include <curl/curl.h>#pragma comment(lib,"libcurl.lib")#define POSTFILES "users_userid=031040108&users_password=*********&verifycode=4702"int main(int argc, char* argv[]){getchar();CURL *curl;CURLcode res;curl = curl_easy_init();if ( !curl  ){printf("1\n");return -1;}curl_easy_setopt( curl , CURLOPT_URL ,"http://xxxy.hbmy.edu.cn/admin.php?mod=admin&file=login" );curl_easy_setopt( curl , CURLOPT_VERBOSE , 1  ) ;curl_easy_setopt( curl , CURLOPT_COOKIEFILE , "1.txt" );curl_easy_setopt( curl , CURLOPT_POSTFIELDS , POSTFILES );res = curl_easy_perform(curl);if ( res != CURLE_OK ){printf("2\n");return -1;}curl_easy_cleanup(curl);return 0;}

上面密码已经被我用******代替了 ,


抓包工具WSExplorer,这次不知道为什么Fiddler不行。

成功图片如下:





原创粉丝点击