Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Fellow Monks
I am writing a script that will query a url and get the html code from the page and then parse it with HTML::TableExtract. I am getting and error in my log file that says:
HTML::TableExtract=HASH(0x1df15b8)

Does anyone know how i can fix this or maybe show me a better way to get my information. The information i need is in a table on this page.
Here's a copy of my code. Please, any help would be appreciated. THNX.
Ray
# Ray Espinoza # GetAPC.pl # This script will take a list of ip addresses of APCs and # send the desired output to a textfile. ###################################################################### #!D:\perl\bin -w use LWP::UserAgent; use HTTP::Request; use HTML::TableExtract #################################################################### +# # Asking for Output file names. #################################################################### +# print "Enter the name of the output file:\n"; chomp($OutFile = <STDIN>); #################################################################### +## # Opens the outfile for appending #################################################################### +## open(OUT,">$OutFile") || die "Can't create $OutFile: $!"; #################################################################### +## # This will log into the apc and grab the html and stuff it into an # array and then i will take that array and add a new line to every # line and stuff that into a variable #################################################################### +### $ua = new LWP::UserAgent; $url = 'http://192.168.1.1/pdumaina'; #print $url; $request = new HTTP::Request('GET',$url); $request->authorization_basic('login', 'password'); $ua->timeout(10); $response = $ua->request($request); $responsecode = $response->code(); if ($responsecode != 200) { print "Failed Request: $responsecode\n"; } else { # login successful, let's get the html code into a variable @ARRAY_OF_LINES = (split "\n", $ua->request($request)->as_stri +ng); foreach $line (@ARRAY_OF_LINES) { $html_code .= $line . "\n"; } } #################################################################### +#### # This will attempt to use HTML::TableExtract to look for these spec +ific # headers in the html tables and print out the values in the table. #################################################################### +#### $te = new HTML::TableExtract( headers => [qw(Outlet Device Name)] ); $te->parse($html_code); print OUT $te; close(OUT) || warn "Couldn't close $OutFile";

In reply to Using HTML::TableExtract by RayRay459

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found