vishi83 has asked for the wisdom of the Perl Monks concerning the following question:

Hi wise monks !!

I hav a request page. This is page has a text area and a textbox. I give some set of statements in the text area and an integer value in the textbox.
So, my request will contain a request xml and a 15 digit key.
On submitting this page, wat i get is a response which will be in the xml format again.

Now my question is :
Using LWP::Useragent i need to fetch this xml output ( the source of that response page ) and write it to a file . How can i do that.

If i want to learn more about extracting the source code of a web page , which modules can i refer to ??

Please help me !!

I tried using LWP::Useragent and HTTP::Request , but am getting no output as if the page is blank ..

Awaiting you reply

thank u !!
vishi83

A perl Script without 'strict' is like a House without Roof; Both are not Safe;

Replies are listed 'Best First'.
Re: Extracting xml source code of a page
by reneeb (Chaplain) on Feb 03, 2006 at 09:39 UTC
    Maybe you want to use WWW::Mechanize

    #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $url = 'http://domain.tld/requestpage.html'; my $your_statements = 'Your Statements'; my $your_digit = 123456789012345; my $filename = '/path/to/file.xml'; my $mech = WWW::Mechanize->new(); $mech->get($url); if($mech->success()){ $mech->submit_form(fields => { name_of_textarea => $your_statements, name_of_textfield => $your_digit}); if($mech->success()){ open(my $fh,">",$filename) or die $!; print $fh $mech->content(); close $fh; } }