W3C home > Mailing lists > Public > xml-dist-app@w3.org > July 2002

Simulating an http post

From: Jon Leigh <jon_leigh@msn.com>
Date: Wed, 24 Jul 2002 16:19:02 -0400 (EDT)
To: <xml-dist-app@w3.org>
Message-ID: <000801c2334f$92864060$65081f3e@007776020343>

I am trying to simulate an http POST in Perl. The following code works
(with a big BUT - see below) :-

#!/usr/bin/perl --

use HTTP::Request::Common qw(POST);
use HTTP::Request::Common;
require LWP::UserAgent;
$ua = LWP::UserAgent->new;

my $req = POST
Content_Type => 'form-data', Content => [parm1 => 'parm1value', parm2 =>
'parm2value', parm3 => 'parm3value', parm4 => 'parm4value', parm5 =>
'parm5value', parm6 => 'parm6value', parm7 => 'parm7value'];

print "Content-type: application/x-www-form-urlencoded\n\n";
print $ua->request($req)->as_string;


The 'BUT' is that whatever the target perl program tries to do, I cannot
prevent a load of rubbish being printed at the top of the screen eg:-

HTTP/1.1 200 OK Connection: close Date: Wed, 24 Jul 2002 20:15:14 GMT
Server: Apache/1.3.20 (Unix) mod_gzip/ FrontPage/
PHP/4.1.1 mod_fastcgi/2.2.12 mod_ssl/2.8.4 OpenSSL/0.9.5a rus/PL30.5
Content-Type: text/html Client-Date: Wed, 24 Jul 2002 20:15:14 GMT
Client-Peer: Title: Data 

If you want to see what I mean, try the following URL which runs the
above perl code:-

Can anybody tell me how to re-code so as to remove this unsightly stuff?


Received on Wednesday, 24 July 2002 17:17:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 22:01:20 UTC