为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用Curl和SSL和cookie登录

如何使用Curl和SSL和cookie登录

PHP
肥皂起泡泡 2019-10-21 14:27:31
我一直在尝试使用curl登录barnesandnoble.com移动网站,到目前为止还没有运气。我返回的页面没有任何错误,它再次将我的电子邮件默认设置为登录页面的电子邮件输入表单框(使用print $ result返回的表单)。通过更改LOGINURL指向eBay的登录名,相同的代码实际上可以使我正确地进入ebay。唯一的区别是barnesandnobles是https://,而ebay登录是http://另外,我相信barnes网站是asp / aspx,所以我不知道该如何处理cookie和_state在过去16小时内尝试调试时,我们将提供任何帮助另外,我的cookie.txt是可写的并且可以正常工作<?php    $cookie_file_path = "C:/test/cookie.txt";    $LOGINURL = "https://cart2.barnesandnoble.com/mobileacct/op.asp?stage=signIn";     $agent = "Nokia-Communicator-WWW-Browser/2.0 (Geos 3.0 Nokia-9000i)";    $ch = curl_init();     $headers[] = "Accept: */*";    $headers[] = "Connection: Keep-Alive";    $headers[] = "Content-type: application/x-www-form-urlencoded;charset=UTF-8";    curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers);    curl_setopt($ch, CURLOPT_HEADER,  0);    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);    curl_setopt($ch, CURLOPT_URL, $LOGINURL);    curl_setopt($ch, CURLOPT_USERAGENT, $agent);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);    $content = curl_exec($ch);     curl_close($ch);     unset($ch);     // NAME="path_state" value="6657403">    if(stristr($content,"path_state")){        $array1 = explode('path_state" value="',$content);        $content1 = $array1[1];        $array2 = explode('">',$content1);        $content2 = $array2[0];    }    $LOGINURL = "https://cart2.barnesandnoble.com/mobileacct/op.asp?stage=signIn";    $POSTFIELDS = "d_hidPageStamp=V_3_17&hidViewMode=opSignIn&stage=signIn&previousStage=mainStage&path_state=" .  $content2 . "&emailAddress=YOUREMAILHERE@gmail.com&acctPassword=YOURPASSWORD";    $reffer = "https://cart2.barnesandnoble.com/mobileacct/op.asp?stage=signIn"; 
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 423 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信