Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need help in my code

         

Stormer

10:57 am on Jul 6, 2004 (gmt 0)

10+ Year Member



my trying to parse google search page.. in which i am successful..

but the problem is i am taking the input from command line ...this way:

BEGIN {

$SRCH_URL = "http://google.com/search?q=@ARGV";
$OP_FILE = "srch.html";
$WGET_CMD = "wget '$SRCH_URL' -O $OP_FILE -U 'MSIE'";
}

this works fine with single word like "donation"....but for multi space word like"programming in perl "or "donation for a child" this script does not work..
kindly help
u can also mail me at jay1982@gmail.com
bye
jay

SeanW

1:19 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



You'll have to URL encode your string anyway, but for now try join()ing the string:

my $searchstring = join "+", @ARGV;

BTW, scraping Google's page is against their TOS. It's far easier to use something like WWW::Search::Google which uses the GoogleAPI, or roll your own.

Sean