Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send Form POST data through Perl

Status
Not open for further replies.

crusade

Technical User
Dec 9, 2003
1
NO
Hi

I have a smal webshop, which i use paypal to accept payments through. I can use a simple Form with post to send the customer and payment info to paypal. The problem is..

I need to be able to collect data from the customer through the form, then and process the data in a perl script, before forwarding it to paypal in the correct format they need,open a new window for the customer so they can get the respons from paypal and proceed with the payment...

So far I am able to send the data, but respons is only 'no_success'

Anyone who has any ideas or hints please?

regards
.runar

Here is the what I use..
..........
use HTTP::Request::Common qw(POST);

# Create a user agent object
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("AgentName/0.1" .$ua->agent);

# Create a request
my $request = POST (' Content_Type => 'form-data',
Content => [
business => 'xxxxxxxx',
item_name => 'item',
item_number => 'idnummer',
amount => '1',
no_note => '1',
currency_code => 'EUR',
]
);

# Pass request to the user agent and get a response back
my $res = $ua->request($request);

# check the outcome
if ($res->is_success){
print $res->content;
}else{
print &quot;Bad luck this time<br>\n&quot;;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top