Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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
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?
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 surveying the Monastery: (6)
As of 2016-04-29 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW







    Results (439 votes). Check out past polls.