I am new at using Modules.  I am writing a program to
accept payments on my website using PayPal.  They
provide an instant notification system for payments
received.  They will send a notice to a url of your
choice if a payment comes in.  I am trying to run a
test script, which is a simplified version of a script
PayPal provides. (I removed the parsing and printing
of the variables that provide info about the payer.) I
cannont seem to get a sucessful response.  The script
runs when paypal hits it, and I can get the variables
they are sending via post, but when I request a
response back saying the payment is verified, I do not
get a sucessful response. I am running this on a Verio
unix server.  Verio has perl 5 and the necessary
Modules installed.  I am not sure what to try next. 
Any suggestions would be much appreciated.


#!/usr/local/bin/perl 

require "../function.pl";


$temp = "notif_post.txt";
open (TEMP, ">>$temp");

# 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; 
use HTTP::Request;
$ua = new LWP::UserAgent or die "new UA: $!"; 
$url = "https://www.paypal.com/cgi-bin/webscr";;
$req = new HTTP::Request('POST', $url) or 
  die "new HTTP::Request POST '$url': $!";
$req->content_type('application/x-www-form-urlencoded');

$req->content($query); 
$res = $ua->request($req);

$test_varif = $res->content;

if ($res->is_success) 
        { 
        print TEMP "Response is a success.\n";
        print TEMP "res: $test_varif";
        }
else {print TEMP "Response was not sucessful.\n"; }

------output in TEMP:
Response was not sucessful.
------------

Gia McCue

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to