Since you are asking for 'specific help', you do need to post the failing code fragment so we can all have sonething to be specific about.
----
I Go Back to Sleep, Now.
OGB
| [reply] |
Yes, you are right. Here is the suspect code:
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','http://www.paypal.com/cgi-bin/webscr'
+;
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);
$res = $ua->request($req);
Everything else works OK. I am sending the buyer an email, the seller an email, and writing a record to a sales header file, and record(s) to a sales detail file. All of that works. The log records no errors.
Thanks for your help!
T.Davis
| [reply] [d/l] |
You will really, really want to use CGI.pm for reading form input.
I'm referring to the first two lines of that script. They will not work when you're using a GET request, for one.
See CGI for much more information how.
| [reply] |
Though I have not worked directly with Paypal, here is a chunk of code I use in working with one of the bigger gateways, FWIW:
use HTTP::Request::Common;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = POST 'http://www.somegateway.com/cgi-bin/somedir',
[
somevariable1 => 'foo',
somevariable2 => 'bar',
];
my $reply;
my $response = $ua->request($req);
if ($response->is_success) {
$reply = $response->content;
} else {
print STDERR $response->status_line, "\n";
}
...do something with $reply...
Usually there are parameters that I send (like credit card info) and then I get a reponse code that I parse (such as 'approved', 'declined').
—Brad "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton
| [reply] [d/l] |