64,654
社区成员
发帖
与我相关
我的任务
分享
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://www.example.net/Login.aspx');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'D:/ck.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'D:/ck.txt');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0");
$rs = curl_exec($ch);
echo $rs;
curl_close($ch);
CURL *pcurl;
QString htmlStr;
pcurl = curl_easy_init();
curl_easy_setopt(pcurl, CURLOPT_URL, "https://www.example.net/Login.aspx");
curl_easy_setopt(pcurl, CURLOPT_POSTFIELDS, postdata.toAscii().data());
curl_easy_setopt(pcurl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(pcurl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(pcurl, CURLOPT_COOKIEJAR, m_ckFileName);
curl_easy_setopt(pcurl, CURLOPT_COOKIEFILE, m_ckFileName);
curl_easy_setopt(pcurl, CURLOPT_WRITEFUNCTION, WriteToMem);
curl_easy_setopt(pcurl, CURLOPT_WRITEDATA, (void *)&htmlStr);
curl_easy_setopt(pcurl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(pcurl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0");
if (curl_easy_perform(pcurl) != CURLE_OK)
{
return;
}