Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Extracting xml source code of a page

by vishi83 (Pilgrim)
on Feb 03, 2006 at 07:38 UTC ( [id://527554]=perlquestion: print w/replies, xml ) Need Help??

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; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://527554]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found