
gingins
Novice
Aug 9, 2006, 1:01 AM
Post #1 of 6
(1725 views)
|
|
extracting url from google search
|
Can't Post
|
|
when running this program it doesn't print out the url results from the page. It's suppose to have to urls listed. steps i took : went to google - > www.google.com and type in the word tulips to do a search . from that result i saved the google page as search.htm . #!/usr/bin/perl $searchresults = &readresults(); &parseresults($searchresults); sub readresults { $size = (stat("/home/xxx/search.htm"))[7]; open(FH, "</home/xxx/search.htm"); read(FH, $filedata, $size); close(FH); return $filedata; } sub parseresults { $searchdata = $_[0]; while ($searchdata =~ /<a class=l href="(.*?)">/ig) { print "$1\n"; } }
|