<?php
$fp = fsockopen("www.paypal.com", 443, $errono, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br>\n";
} else {
    fputs ($fp, "GET https://www.paypal.com/cgi-bin/webscr
HTTP/1.1\015\012");
    fputs ($fp, "HOST www.paypal.com\015\012");
    fputs ($fp, "Content-type: application/x-www-form-urlencoded\015\012");
    fputs ($fp, "Content-Length: ". strlen($query)."\015\012");
    fputs ($fp, "Connection: Close\015\012");
    fputs ($fp, $query); // you might want to do some urlencoding here, if
it hasn't been done already..
    fputs ($fp, "\015\012\015\012");
    while (!feof($fp)) {
        $return .= fgets ($fp,128);
    }
    fclose ($fp);
}
?>

----- Original Message -----
From: "Richard Kurth" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 4:01 PM
Subject: [PHP] Changing perl to PHP


> Could somebody tell me how to convert this little bet of code to PHP.
> The rest of the code for this was easy to do but I dont know what to
> do with this. Can I call LWP from php and if yes how?
>
> # read the post from PayPal system and add 'cmd'
> read (STDIN, $query, $ENV{'CONTENT_LENGTH'});
> $query .= '&cmd=_notify-validate';
>
> # post back to PayPal system to validate
> use LWP::UserAgent;
> $ua = new LWP::UserAgent;
> $req = new HTTP::Request 'POST','https://www.paypal.com/cgi-bin/webscr';
> $req->content_type('application/x-www-form-urlencoded');
> $req->content($query);
> $res = $ua->request($req);
>
>
>
>
>
>
>
>
>
>
>
>
>
> Best regards,
>  Richard
> mailto:[EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to