YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Need help with script, example? Options
xlittlemischief
#1 Posted : Tuesday, April 06, 2004 5:31:10 PM
Rank: Starting Member

Groups: Registered

Joined: 4/3/2004
Posts: 3
Location: ,
I have been trying for days to get IPN to work with the test bed. This is my CGI script (slightly modified from paypal's example) #!d:/perl/bin/perl.exe # read 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','http://www.eliteweaver.co.uk/testing/ipntest.php'; $req->header('Host','www.eliteweaver.co.uk'); $req->content_type('application/x-www-form-urlencoded'); $req->content($query); $res = $ua->request($req); # split posted variables into pairs @pairs = split(/&/, $query); $count = 0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $variable{$name} = $value; $count++; } # assign posted variables to local variables $item_name = $variable{'item_name'}; $item_number = $variable{'item_number'}; $payment_status = $variable{'payment_status'}; $payment_amount = $variable{'mc_gross'}; $payment_currency = $variable{'mc_currency'}; $txn_id = $variable{'txn_id'}; $receiver_email = $variable{'receiver_email'}; $payer_email = $variable{'payer_email'}; print "content-type: text/plain\n\n"; if ($res->is_error) { # HTTP error print "HTTP Error\n"; } elsif ($res->content eq 'VERIFIED') { # check the $payment_status=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 print "Verified\n"; } elsif ($res->content eq 'INVALID') { # log for manual investigation print "Invalid\n"; } else { # error print "Genral Error\n"; } print "Done"; Any ideas why this isn't working? is anything wrong with my code? Server setup maybe? i'm useing Xitami on a windows box
Sponsor  
 
Andrew Chang
#2 Posted : Tuesday, April 06, 2004 8:22:16 PM
Rank: Starting Member

Groups: Registered

Joined: 1/10/2003
Posts: 738
Location: ,
there are no errors in the script.

Do you have the Perl Mod installed?

LWP::UserAgent

Andrew Chang
Our Services
Script to sell downloads: http://scorpionsystems.net/itemseller
Web Design & Scripting: http://www.scorpionsystems.net
Web & Image Hosting includes global SSL: http://www.scorpionwebhosting.com
Have something to announce: http://worldannouncements.com
Free Web Traffic: http://www.trafficswarm.com/go.cgi?169137
MSN ID: 0143@optonline.net
xlittlemischief
#3 Posted : Thursday, April 08, 2004 10:36:53 PM
Rank: Starting Member

Groups: Registered

Joined: 4/3/2004
Posts: 3
Location: ,
Yes I do, the script runs fine. but on the test bed it's telling me the script isn't responding. Not sure how to do a live test. Am getting a 302 message from the test bed instead of a 200 ok. already tried updating the lwp mod.
PayPal_Dave
#4 Posted : Thursday, April 15, 2004 4:58:02 PM
Rank: Starting Member

Groups: Registered

Joined: 2/13/2004
Posts: 109
Location: ,
Hi xlittlemischief,

I see this line in the script you posted:

$req = new HTTP::Request 'POST','http://www.eliteweaver.co.uk/testing/ipntest.php';

Did you change this in production? Is it when your script tries to do the POST back to PayPal that you get the 302 return code?

Dave Burchell
PayPal Technical Support
PayPal, an eBay company
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.217 seconds.