Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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:

Hi,

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.

Comment on Get HTML content
Re: Get HTML content
by kennethk (Monsignor) 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
by PerlSufi (Pilgrim) 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.
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 :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-07-13 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls