Any help would be appreciated..
Example:
use HTTP::Request::Common qw (POST);
use LWP::UserAgent;
use XML::Parser;
use HTTP::Request;
use HTTP::Response;
use URI::Heuristic;
use CGI;
$cc = '4168';
$ua = LWP::UserAgent->new();
my $req = POST 'https://xml.payments.com',
[ name => '<EngineDocList>
<DocVersion>1.0</DocVersion>
<EngineDoc>
<ContentType>OrderFormDoc</ContentType>
<User>
<Name>$cc</Name>
</User>
</EngineDocList>' ];
my $response = $ua->request($req);
if($response->is_error) {
printf " %s\n", $response->status_line;
}
else
{
my $count;
my $bytes;
my $content = $response->content();
# $p = new XML::Parser(Style => 'Debug');
my $p = new XML::Parser(ErrorContext => 2,
Handlers => {Start => \&start_handler,
End => \&end_handler
I don't see any replacement attempts in your code so I'm not sure people will understand your exact problem with that code snippet.
Looks like $req only contains a value for the URL.. so if you want to replace something in the URL maybe you could do the replacement before making it part of $req?
something like
my $xml = qq~
<EngineDocList>
<DocVersion>1.0</DocVersion>
<EngineDoc>
<ContentType>OrderFormDoc</ContentType>
<User>
<Name>$cc</Name>
</User>
</EngineDocList>'
~;
That really should work ..:)
and then
my $req = POST 'https://xml.payments.com',
[ name => '$xml' ];
I haven't tried it but maybe it helps..
<added> On second thought it probably won't work..
if it prints $xml try it without the quotes.. it's a longshot but who knows.. </added>