Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
ERROR MESSAGE: HTTP POST error code: 500 HTTP POST error message: Internal Server Error#!/usr/bin/perl #use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $server_endpoint = "http://localhost/cgi-bin/process.cgi"; # set custom HTTP Request header fields my $req = HTTP::Request->new(POST => $server_endpoint); $req->header('content-type' => 'text/xml'); $req->content($xml); my @files = (glob("*.xml")); print "@files\n"; foreach $test(@files){ #print "this element: $test \n "; open FILE, $test or die $!; # my $lineno=1; while(<FILE>){ $xml = $_; print $xml; } } my $resp = $ua->request($req); if ($resp->is_success){ my $message = $resp->decoded_content; print "Received reply:\n $message\n"; } else { print "HTTP POST error code: ", $resp->code, "\n"; print "HTTP POST error message: ", $resp->message, "\n"; } <code> code which will receive multiple xml files.. <code> #!/usr/bin/perl use strict; use CGI; use DBI; use XML::Twig; use CGI::Carp 'fatalsToBrowser'; my $cgi = CGI->new; print $cgi->header(-type => "text/xml", -charset => "utf-8"); my $xml = $cgi->param("POSTDATA"); print $xml received;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTP POST error
by hippo (Archbishop) on May 27, 2014 at 21:53 UTC | |
|
Re: HTTP POST error
by taint (Chaplain) on May 27, 2014 at 21:12 UTC | |
|
Re: HTTP POST error
by Anonymous Monk on May 28, 2014 at 19:54 UTC | |
by poj (Abbot) on May 28, 2014 at 20:19 UTC | |
|
Re: HTTP POST error
by Anonymous Monk on May 29, 2014 at 19:03 UTC | |
|
Re: HTTP POST error
by Anonymous Monk on May 30, 2014 at 08:17 UTC |