curl-and-php
RE: redirect troubles...
Date: Thu, 22 Jan 2004 07:37:22 -0600
Not to sound stupid but does not paypal allow you to setup some kind of
secure channel between you and them. That way you submit a page to them and
they respond back to you with the completed details. I know for a fact they
give you the PHP and ASP code to do this. Instead of pirating paypals
website you really should send the user there. The site below gives you a
ton of options for doing what I hope you are trying to do.
Check out this page maybe this is what you are looking for.
http://www.paypal.com/cgi-bin/webscr?cmd=_merchant-outside
Here is the sample PHP they provide:
<?php
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously
processed
// check that receiver_email is your Primary PayPal
email
// check that payment_amount/payment_currency are
correct
// process payment
} else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>
-----Original Message-----
From: curl-and-php-admin_at_lists.sourceforge.net
[mailto:curl-and-php-admin_at_lists.sourceforge.net] On Behalf Of Ace Mc Kool
Sent: Wednesday, January 21, 2004 6:14 PM
To: curl-and-php_at_lists.sourceforge.net
Subject: RE: redirect troubles...
>Why is it you can't have (or don't want) the parameters in the page
>URL?
With PayPal, the price can be modified by changing the GET variables. Thank
you everyone for your input, this has been enlightening!
-m
_________________________________________________________________
Scope out the new MSN Plus Internet Software - optimizes dial-up to the max!
http://join.msn.com/?pgmarket=en-us&page=byoa/plus&ST=1
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the
breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-22