PHP Curl会话cookie SSL登录(错误)
PHP Curl会话cookie SSL登录错误 我在其他网站上没有遇到任何问题 我在登录后收到错误处理请求。登录页面需要用户/通行证和令牌 这是改变了很多不同的配置,使其工作,但没有运气 http已被删除,无法发布PHP Curl会话cookie SSL登录(错误),php,session,ssl,curl,cookies,Php,Session,Ssl,Curl,Cookies,PHP Curl会话cookie SSL登录错误 我在其他网站上没有遇到任何问题 我在登录后收到错误处理请求。登录页面需要用户/通行证和令牌 这是改变了很多不同的配置,使其工作,但没有运气 http已被删除,无法发布 $curl = curl_init(); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_USER
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 10; Windows NT 8.1)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cooker.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cooker.txt"); # SAME cookiefile
curl_setopt($curl, CURLOPT_URL, "XXXX.k.com/?nf=3&nf=4&siteID=0&WT.mc_id=0");
$xxx = curl_exec($curl);
preg_match_all('/name=\"token\" value=\"(.*?)\">/is', $xxx, $matches);
foreach($matches[1] as $token)
print $token;
curl_setopt($curl, CURLOPT_URL, "XXX.k.com/consumers/loginSubmitAction.do"); # this is where you first time connect - GET method authorization in my case, if you have POST - need to edit code a bit
curl_setopt($curl, CURLOPT_POSTFIELDS, "MYEMAIL% 40DOMAIN.com&password=MYPASSWORD&token=$token&sslRedirect=noRedirect");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cooker.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cooker.txt"); # SAME cookiefile
$xxx = curl_exec($curl);
preg_match_all('/name=\"token\" value=\"(.*?)\">/is', $xxx, $matches);
foreach($matches[1] as $token)
print $token;
curl_setopt($curl, CURLOPT_URL, "http://www.k.com/consumers/reportSubmitAction.do"); curl_setopt($curl, CURLOPT_POSTFIELDS, "vin=$vin&$token&sslRedirect=noRedirect");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cooker.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cooker.txt"); # SAME cookiefile
$xxx = curl_exec($curl);
echo $xxx;
curl_close ($curl);