Perl Basics
Introduction to Perl
FAQ's
CGI
Regular Expressions

PC Overview
Cool Stuff
My Modules
Success Stories
Links
Perl in the News
Logos

PC Internals
About
Contact
Handy Logos
What's new

https XML POST with LWP

See also
P-friendly

[ home ] - [ search ] - [ sitemap ]


up

#!/usr/bin/perl -w
use strict;

use LWP::UserAgent;
use HTTP::Request::Common;

use Net::SSL;
use LWP::Protocol::https;
use URI::https;

&main();

sub main() {
	my $ua = LWP::UserAgent->new(agent => 'xml client');

	my $resp = $ua->request(
		POST 'https://www.example.com/upp/jsp/XML_authorize.jsp' ,
		Content_Type  => 'application/x-www-form-urlencoded',

		Content       => [ xmlRequest =>
				q~<?xml version="1.0" encoding="UTF-8" ?>
				<authorizationService version="1">
				   <body merchantId="1000011011" testOnly="yes">
				     <transaction refno="1234987">
				       <request>
					 <amount>100</amount>
					 <currency>CHF</currency>
					 <cardno>4950000111111110</cardno>
					 <expm>11</expm>
					 <expy>04</expy>
				       </request>
				     </transaction>
				   </body>
			 </authorizationService>~
				]
	);

	print $resp->error_as_HTML unless $resp->is_success;

	print $resp->content();
}
home - feedback - search

$Id: foo.htm,v 1.10 2004/03/11 17:50:01 reto Exp $
© 1998-2004 reto :)