模拟登陆亚马逊问题,模拟登陆amazon问题

模拟登陆亚马逊问题,模拟登陆amazon问题

<?php
header('content-type:text/html;charset=UTF-8');
include ("include/curlClass.php");
include ("include/simpledomClass.php");
$cookie_file=tempnam("./TEMP","cookie_z_cn.txt");


if($_POST["getcookie"]){


//登陆地址
$login_url='https://www.amazon.cn/ap/signin?ie=UTF8&pf_rd_r=1P87RMNCKVX1FQ9T1QMX&pf_rd_m=A1AJ19PSB66TGU&pf_rd_t=6301&pf_rd_i=cnflex&pf_rd_p=66012152&pf_rd_s=signin-slot';


//获取cookie
$ch = curl_init($login_url);
curl_setopt($ch,CURLOPT_COOKIEJAR, $cookie_file);//把返回来的cookie信息保存在文件中
curl_exec($ch);
curl_close($ch);


$email=urldecode('[email protected]');  //转码email
//POST信息
$post_fields  = array(
'appActionToken'=>'vFA71yPDd7EP3FMppAC75gdEiEAj3D',
'appAction'=>'SIGNIN',
'openid.pape.max_auth_age:ape'=>'MA==',
'openid.ns:ape'=>'aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjA=',
'openid.ns.pape:ape'=>'aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvZXh0ZW5zaW9ucy9wYXBlLzEuMA==',
'pageId:ape'=>'Y25mbGV4',
'openid.identity:ape'=>'aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=',
'openid.claimed_id:ape'=>'aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=',
'openid.mode:ape'=>'Y2hlY2tpZF9zZXR1cA==',
'openid.assoc_handle:ape'=>'Y25mbGV4',
'openid.return_to:ape'=>'aHR0cHM6Ly93d3cuYW1hem9uLmNuL2dwL2Nzcy9ob21lcGFnZS5odG1sP2llPVVURjgmcmVmXz1nbm9feWFtX3lh',
'email'=>$email,
'create'=>0,
'password'=>'XXXXXXXXXXXXXXXX',
'x='>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7DCZp46MZk1mrQv0RiwtnEiq8/bE3eH/Nj0yt1wJciLpsNmrkICKBVERsp0i4ckuwb2XuHngabZlm/FTR3V4uXUn2h8cY0n7659WLhNTcEIKHDguf6oVdy+sk1QNOGxlVxJsVTChJb3VITwPSeK4m17xSQexdVzFPWlevMs975MbL7mSKIg/SmHcu2mW+zHyz1botoiXQCJ8u3HeYwoSyTV9yWYgVWriwUABn0SJJMo69jrM9IbqwZBfZJ6Lm2IH87CuvxiRREmp6xY6b1667ZYiKWjpFWPUFfjuaoIgsYkOTYHK36T/ksqYGEBKnLarUWISLJjXpMJcWnre/rOeYVgDX/PmqcWODk3bP8wfps/hxnIL+wOUB3tRMwJj/aKaZ4zLJKU0CzP7+5mkJg1/C8x1hGQEpqZQOoGGYXL94E1qpaJQ9PZFNCdQUbX5+qI88Uya4fADT7bMywdOu4haODHZKX0dONJ4fvC5Kr5Fs8WX1l42RNCmoCagP2ZxbGH84dmSVL/fqLIHXh7OuFOSkNs+BICMHT6GiTx/yho21euJdbK5bqhQxL8nEAZvf8aJGmVi3S16081czntC2VcLuHd2UoqB5hopI7PuIBEj8iVV9GGt5F4taJnqAleFo/dbbTJBppVhHx6qrD0CB/jS4Dz+F65vglPAXY9dwtGH3hz8R30Hrw'
);

$post_fields = http_build_query($post_fields);


$headers = array(
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding:gzip,deflate,sdch',
'Accept-Language:zh-CN,zh;q=0.8',
'Cache-Control:max-age=0',
'Connection:keep-alive',
'Content-Length:2580',
'Content-Type:application/x-www-form-urlencoded',
'Host:www.amazon.cn',
'Origin:https://www.amazon.cn',
'Referer:https://www.amazon.cn/ap/signin?_encoding=UTF8&openid.assoc_handle=cnflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.cn%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26ref_%3Dgno_signin',
'User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36'
);

$mycurl=new CURL($cookie_file);

/********模拟登陆*********/
$content=$mycurl->vlogin($login_url,$post_fields,$headers);
echo $content;
/********模拟抓取*********/
//$content=$mycurl->vget($get_url,$headers);

//截取内容  
//$dom = new simpledomClass();
//echo $dom->getJingdongOrder($content);


} else {
?>
<form id="form1" name="form1" method="post" action="">
<input type="hidden" name="getcookie" value="getcookie">
<input type="submit" name="button" id="button" value="登陆" />
</form>
<?php } ?>


问题提示:

400 Bad Request


你可能感兴趣的:(curl,Amazon,亚马逊)