我正在尝试为亚马逊进行远程登录。所以基本上,用户将通过我们的本地表单登录。如果他填写的所有内容都正确,他将在亚马逊登录。`
if(isSet($_POST['submit']))
{
$account = $_POST["account"];
$pass = $_POST["pass"];
$ch = curl_init("https://www.amazon.com/ap/signin?_encoding=UTF8&openid.assoc_handle=usflex&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.com%2Fgp%2Fyourstore%2Fhome%3Fie%3DUTF8%26ref_%3Dnav_ya_signin");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIESESSION, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, "ap_email=" .$account."&ap_password=".$pass."");
curl_exec($ch);
if (curl_errno($ch))
{
print curl_error($ch);
}
else
{
curl_close($ch);
}
}
else
{
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="login">
<table width="100%">
<tr align="center">
<td width="50%" align="right"><font color="navy">E-Mail</font></td>
<td width="50%" align="left"><input type="text" name="account" size="10"></td>
</tr>
<tr align="center">
<td width="50%" align="right" width="100"><font color="navy">Password</font></td>
<td width="50%" align="left"><input type="password" size="10" name="pass"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr align="center">
<td colspan="2" align="center"><input name="submit" type="submit" value="Inloggen"></td>
</tr>
</table>
</form>
<?php } ?>`
这是我使用过的代码。我收到以下错误:
请启用 Cookie 以继续
要继续在 Amazon.com 购物,请在您的网络浏览器中启用 Cookie。详细了解 Cookie 以及如何启用它们。
在浏览器中启用 cookie 后,请单击下面的按钮返回上一页。
如何修复此错误?我什么都试过了。
我现在正在使用XAMPP。
仅用于标记为答案:
你必须做两件事:
1 - 使用 get 方法从服务器请求登录页面
2 - 使用新会话和隐藏输入发送登录数据
查看脚本 : https://stackoverflow.com/a/7532730/889678