Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Get HTML content

by spikeinc (Acolyte)
on Aug 01, 2013 at 18:19 UTC ( #1047492=perlquestion: print w/replies, xml ) Need Help??
spikeinc has asked for the wisdom of the Perl Monks concerning the following question:


Am trying something new. I want to collect some stats from a webpage using perl and parse it, and display it as output. The webpage contains a table of stats so when I run the script it should call the method invoked by html get (i can find it using fiddler tool) and then get the content of the table in a string and parse it.

I am kinda new to perl so can anyone help me get started? How can I achive this... thanks.

Replies are listed 'Best First'.
Re: Get HTML content
by kennethk (Abbot) on Aug 01, 2013 at 18:38 UTC

    There is a large number of ways to attack this, but I'd suggest using LWP::Simple combined with Mojo::DOM for parsing the tree. HTML::Parser or HTML::TreeBuilder are also options for the parse. how to parse html perl should give you some basic codes.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: Get HTML content (imagine)
by Anonymous Monk on Aug 02, 2013 at 03:42 UTC
      Thankyou very much everyone! I love perlmonks :)

      definitely helps me to start

      shall post questions as I proceed :)
Re: Get HTML content
by PerlSufi (Friar) on Aug 01, 2013 at 21:23 UTC
    Look into the modules kennethk recommended. I also like to use WWW::Mechanize. The  $mech->dump_text; or  print $mech->$content; approaches may work for you. The first method displays all of the text on the page, the second displays all of the HTML content of the page- including HTML elements.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1047492]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2018-02-23 18:48 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (307 votes). Check out past polls.