Use OLE to drive IE and scrape the results.

Here's a snippet of code that I used years ago to check warrantee expiration on 
a list of HP servers. The HP web page used javascript and redirections before 
finally ending up on the page with the data.


                my $parms = 'country=US&' .
                    "serialNumber1=$serial&" .
                                'BODServiceID=NA&' .
                    "productNumber=$prod&" .
                    'RegisteredPurchaseDate=';

                my $ie = Win32::OLE->new('InternetExplorer.Application');

                
$ie->Navigate("http://us.itrc.hp.com/service/ewarranty/warrantyResults.do?$parms";);

while( $ie->{Busy} ) {
                                Win32::Sleep(200);
                }

                Win32::Sleep(1000);

                return "" unless $ie->Document;
                return "" unless $ie->Document->Body;

                my $res = $ie->Document->Body->{InnerHTML};

                $ie->Quit;



From: perl-win32-users-boun...@listserv.activestate.com 
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Greg 
Aiken
Sent: Thursday, February 14, 2013 7:37 PM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: perl to web-scrape an html page that requires 'Javascript' to fully 
render

ive used the sample/simple lwpget.pl<http://lwpget.pl> sample script (thats 
found in numerous place on the internet, which uses LWP package).

if the url requested is 'static content', the page is received in its 
full/complete content.

if however, the url requested is dynamic content (that normally requires 
Javascript to be running in the 'client-browser-environment' - to be fully 
rendered) - then obviously, in this case - such a page does not retrieve with 
all parts being present.

is there any perl package that adds Javascript functionality to the basic 
lwpget.pl<http://lwpget.pl> - so that when the 
perl-script-acting-as-a-web-client requests the page, its actually parsed, and 
javascript functions are performed - to allow the perl requested page to be the 
full equivalent as if the page were rendered in a fully Javascript aware web 
browser?

any help here would be appreciated, as well as a sample script.

sincerely,

greg
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to