Extracting xml source code of a page
vishi83
created: 2006-02-03 02:38:12
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;
Re: Extracting xml source code of a page
created: 2006-02-03 04:39:51
Maybe you want to use [cpan://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;
  }
}

perlmonks.org content © perlmonks.org and reneeb, vishi83

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03