W3C home > Mailing lists > Public > xml-dist-app@w3.org > October 2001

Re: Sending XML codes through HTTP post in Perl

From: Ahmad Anvari <ahmad@otelnet.com>
Date: Fri, 5 Oct 2001 13:00:54 -0700 (PDT)
To: Dirk-Willem van Gulik <dirkx@covalent.net>
cc: xml-dist-app@w3.org
Message-ID: <Pine.GSO.4.20.0110051259140.16698-100000@eagle.otelnet.com>

Everybody: Ignore my last message. Downloaded all the necessary
modules one by one [not using perl -MCPAN], compiled all and
sent the request successfully, [however, nothing was in res->content
just check res->as_string and everyghing was OK, 200]. Thank
you very  much Dirk_Willem, you're a big help man.
_Ahmad

On Fri, 5 Oct 2001, Dirk-Willem van Gulik wrote:

> 
> Yes. that is autom,ated: Just do
> 
> 	         perl -MCPAN -e shell;
> 
> 
> And wall through the options.
> 
> Dw
> 
> On Fri, 5 Oct 2001, Ahmad Anvari wrote:
> 
> >
> > Great! Quick reply! Should I download LWP-attic from this
> > page: http://www.cpan.org/modules/by-module/LWP/ Lots of
> > options there.
> > _Ahmad
> >
> > On Fri, 5 Oct 2001, Dirk-Willem van Gulik wrote:
> >
> > >
> > >
> > > On Fri, 5 Oct 2001, Ahmad Anvari wrote:
> > >
> > > > One quick question, is there anyone here who has sent and received
> > > > XML through HTTP post in perl? What's the simplest way to send XML
> > > > through HTTP post to a specific host and port (obviously, someone
> > > > is listening over there to send another XML after processing the
> > > > request). How about opening a telnet connection? *URGENT*
> > >
> > > Just use LWP - from the man
> > >
> > >          # Create a user agent object
> > >          use LWP::UserAgent;
> > >          $ua = new LWP::UserAgent;
> > >          $ua->agent("AgentName/0.1 " . $ua->agent);
> > >
> > >          # Create a request
> > >          my $req = new HTTP::Request POST =>'http://www.perl.com/cgi-bin/BugGlimpse';
> > >
> > > # put XML payload here.
> > > #
> > >          $req->content_type('application/x-www-form-urlencoded');
> > >          $req->content('match=www&errors=0');
> > >
> > >          # Pass request to the user agent and get a response back
> > >          my $res = $ua->request($req);
> > >
> > >          # Check the outcome of the response
> > >          if ($res->is_success) {
> > >              print $res->content;
> > >          } else {
> > >              print "Bad luck this time\n";
> > >          }
> > >
> > > Note how far one strays from the http/cgi paht :-)
> > > Dw
> > >
> > >
> >
> >
> 
> 
Received on Friday, 5 October 2001 16:01:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:04 GMT