Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do I get information from a vendors web page.

by RayRay459 (Pilgrim)
on Mar 26, 2002 at 00:05 UTC ( [id://154276]=note: print w/replies, xml ) Need Help??


in reply to How do I get information from a vendors web page.

marza
I had a similar need and wrote a script that goes to a few urls, grabs the html and stuffs it into an array and then uses a regex to find the information that i want, and then prints it out. That may be one way to check the version date on McAfee's website. Here's an excerpt of the code that i wrote:
use strict; use LWP::UserAgent; ##### Declaring my local variables, initializing useragent and open lo +g file.####### my($url, @urls); my $ua = LWP::UserAgent->new(); open(OUT,">results.log") or die "Couldn't open results.log"; print OUT "\n"; ##### Stuffing the urls into an array ##################### @urls = ("http://www.blahblah.com, http://www.blah.com, ); #### Looping through the urls, grabbing the html and stuffing it into +an array. #### foreach $url(@urls){ my $request = new HTTP::Request('GET',$url); $ua->timeout(10); my $response = $ua->request($request); my $responsecode = $response->code(); print "GET failed\n" if $responsecode != 200; my @ARRAY_OF_LINES = (split "\n", $ua->request($request)->as_string); my $row; #### Parsing the html with a regex to find the the updated times ##### +## foreach $row (@ARRAY_OF_LINES) { chomp($row); if ($row =~ /.*?Updated\s*:\s*(\w+\s*-\s*\d{1,2}\s+\d{1,2}:\d{1,2 +}:\d{1,2}\s+PST)/i) { print OUT "Last Updated: $1\n\n"; last; }elsif ($row =~ /.*?Updated\s*:\s*(\w+\s*\w+\s*\d{1,2}\s+\d{1, +2}:\d{1,2}:\d{1,2}\s+PST\s*\d*)/i) { print OUT "Last Updated: $1\n\n"; last; } } } close(OUT);
Good luck and i hope this can point you in the right direction.
Ray

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://154276]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found