2

I'm trying to make a remote log-in for Amazon. So basically, an user will log-in through our local form. And if everything he filled in is correct, he will be logged in at Amazon. `

            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>&nbsp;</td> 
            </tr> 
            <tr align="center"> 
                <td colspan="2" align="center"><input name="submit" type="submit" value="Inloggen"></td> 
            </tr> 

        </table> 
        </form> 
        <?php } ?>`

This is the code I've used. And I'm getting the following error:

Please Enable Cookies to Continue

To continue shopping at Amazon.com, please enable cookies in your Web browser. Learn more about cookies and how to enable them.

Once you have enabled cookies in your browser, please click on the button below to return to the previous page.

How can I fix this error? I've tried everything.

I'm using XAMPP at the moment.

aynber
  • 22,380
  • 8
  • 50
  • 63

1 Answers1

0

Just for marking as answer:

you have to 2 things:

1 - Request login page from server using get method

2 - Send login data using new session and with hidden inputs

to see the script : https://stackoverflow.com/a/7532730/889678

Community
  • 1
  • 1
Faiz Rasool
  • 1,379
  • 1
  • 12
  • 20