Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Friday January 24, 2003
08:32 PM

Are you feeling lucky?

[ #10179 ]

Right now you are thinking "Do I have a web browser or don't I?".

You have to ask yourself one question---"Do I feel lucky?"

use strict;
use HTML::TreeBuilder;
use HTML::FormatText;
use LWP::Simple;
use SOAP::Lite;
# get everything at
my $search = SOAP::Lite->service("File:GoogleSearch.wsdl");
my $results = $search->doGoogleSearch(
        $ENV{GOOGLE_KEY}, "@ARGV", 0, 1,
        "false", "", "false", "", "latin1", "latin1");
my $link = $results->{resultElements}[0]{URL};
my $data = get( $link );
my $tree = HTML::TreeBuilder->new_from_content( $data );
print HTML::FormatText->new(leftmargin => 0, rightmargin => 50
    )->format( $tree );