Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: A regexp from paypal

by Cubes (Pilgrim)
on Nov 25, 2007 at 22:20 UTC ( [id://652875]=note: print w/replies, xml ) Need Help??


in reply to Re^2: A regexp from paypal
in thread A regexp from paypal

Since CGI.pm gives you a couple of ways to fetch all the parameters it's passed, you could just add your new parameter to the list and then send it all back out using LWP.

With a little bit of error checking, this could also save you from blindly sending back out any malformed data you receive.

Replies are listed 'Best First'.
Re^4: A regexp from paypal
by Anonymous Monk on Nov 25, 2007 at 23:16 UTC
    This is what I have so far
    #!/usr/bin/perl use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my $q = new CGI; $q->param(-name=>'cmd',-value=>'_notify-validate'); # read post from PayPal system and add 'cmd' #read (STDIN, my $query, $ENV{'CONTENT_LENGTH'}); #$query .= '&cmd=_notify-validate'; # post back to PayPal system to validate use LWP::UserAgent; my ($ua,$req,$res); $ua = new LWP::UserAgent; $req = new HTTP::Request 'POST','http://www.eliteweaver.co.uk/testing/ +ipntest.php'; $req->content_type('application/x-www-form-urlencoded'); $req->content($q); $res = $ua->request($req);
    I need to add the cmd = _notify-validate name, value pair to the post string and then send it back out using LWP. When I send it out I am sending the CGI object itself out. ---- Now, here is some code that seems to do the trick well but I want to use the CGI module to do this (if possible) This is not my code, it is paypal's
    # 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.paypal.com/cgi-bin/webscr' +; $req->content_type('application/x-www-form-urlencoded'); $req->content($query); $res = $ua->request($req);
      Unless I'm way off base, you should be able to set the param you need using CGI, after which it will be part of the object you send in your request.
        I have set the param before using $q->param(-name=>,-value=>) and then sending the object off in my LWP request. This doesn't work and I'm guessing it is because it is simple a perl hash and would show up in the content of the request as HASH(x010101) or whatever, not as a POST request with the name=value pairs. Is that correct?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://652875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-09-10 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.