LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-25-2007, 05:28 PM   #1
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Rep: Reputation: 15
CGI.pm accessing raw POST data


I would like to use CGI.pm to access the raw POST data sent to me from paypal and then send it back out using LWP. This code does it well.

Code:
# 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);
However, I want to use the CGI module, any ideas? I have added it using the $q->param(-name,-value) function but I have no idea what I should be sending out through LWP, as it is a hash. I have tried sending the CGI object itself with no luck.
 
Old 11-26-2007, 03:02 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Seems to me that the CGI module is a server-side component, where your application seems to be a client. This doesn't seem to be a good fit for the CGI module.
--- rod.
 
Old 11-28-2007, 06:04 PM   #3
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
That seems to be the case. The new query object from the CGI module isn't proving suitable to return to the server. This is unusually however as the same thing was done in the CPAN module Business::PayPal::IPN.
 
Old 11-29-2007, 03:07 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
er, if what you posted works, why do you want to use the CGI module?


I don't get it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture RAW Printer Data metalx1000 Linux - General 1 10-22-2007 08:13 AM
How can I post data with POST method in C programming. haxpor Programming 24 04-11-2007 08:34 AM
Raw data telnet bh5687 Linux - Newbie 1 03-23-2006 08:56 AM
Capturing raw mouse data pld Linux - Software 4 04-11-2004 08:13 PM
Raw Packet Data vanibhat Linux - Security 1 08-01-2003 07:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration