|
| Author |
Message |
prof3ta Young One

Joined: 04 Mar 2004 Posts: 64
   
|
|
| Back to top |
|
 |
mat007 Almost An Agent

Joined: 12 Jan 2004 Posts: 1375
   votes: 2
|
Posted: Mon Mar 08, 2004 7:10 pm Post subject: |
|
|
| Code: | | if ($msg =~ /^google (.*)$/i) {<br />&send($self, "Searching for $1....","$username" );<br />$reply = google($1);<br />&send($self, "$reply");<br />goto end;<br />}<br /><br />sub google{<br />my $q = shift;<br />my $max = 10;<br />my $startat = 0;<br />my $restrict = '';<br />my $language = '';<br /><br /># Insert key below!<br />##########################<br />$googlekey = '..KEY...HERE!';<br />##########################<br /><br />my @hello = ($googlekey, $q, $startat, $max, 1, $restrict, 1, $language, 'UTF-8', 'UTF-8');<br /><br />my $bye = SOAP::Lite -> service("http://api.google.com/GoogleSearch.wsdl") -> doGoogleSearch(@hello);<br /><br />$count = 0;<br /><br />$reply = "Results:\n";<br /><br />foreach $you (@{$bye->{resultElements}}){<br />$reply .= "\n".++$count.": ". $you->{title} . " - ". $you->{URL};<br />}<br /><br />if ($count == 0) {<br />$reply = "Sorry, nothing found.";<br />}<br /><br />$reply =~ s/\<b\>//ig;<br />$reply =~ s/\<\/b\>//ig;<br />return $reply;<br />} |
|
|
| Back to top |
|
 |
jeanhub Almost An Agent

Joined: 14 Feb 2004 Posts: 1138
 
|
Posted: Mon Mar 08, 2004 10:22 pm Post subject: |
|
|
i dont know if this is an error...
| Quote: | < ********@hotmail.com > - !google test Subroutine google redefined at (eval 105) line 8. |
|
|
| Back to top |
|
 |
prof3ta Young One

Joined: 04 Mar 2004 Posts: 64
   
|
Posted: Tue Mar 09, 2004 3:50 am Post subject: |
|
|
| Thanks! that did it, just had to solve some issues with my perl in linux. You sure know your stuff.... |
|
| Back to top |
|
 |
jeanhub Almost An Agent

Joined: 14 Feb 2004 Posts: 1138
 
|
Posted: Tue Mar 09, 2004 10:22 pm Post subject: |
|
|
| do we need to download a program to make it work? |
|
| Back to top |
|
 |
djwk Young One

Joined: 09 Mar 2004 Posts: 86
   
|
Posted: Thu Mar 25, 2004 9:35 pm Post subject: |
|
|
| no you dont need a program to make it work but *lazy* do need a license key |
|
| Back to top |
|
 |
Myzterio Not Yet a God

Joined: 13 Dec 2003 Posts: 429
    
|
Posted: Thu Mar 25, 2004 9:43 pm Post subject: |
|
|
or you can use this
| Code: | | if($msg =~ /^#google (.*)$/)<br /> {<br /> $self->sendmsg("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=$1",Font => "Verdana",Effect => "B");<br /> $msg =~ s/ /\+/g;<br /> } |
|
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Thu Mar 25, 2004 9:45 pm Post subject: |
|
|
QUOTE(Myzterio @ Mar 25 2004, 04:43 PM) or you can use this | Code: | | if($msg =~ /^#google (.*)$/)<br /> {<br /> $self->sendmsg("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=$1",Font => "Verdana",Effect => "B");<br /> $msg =~ s/ /\+/g;<br /> } | | That would convert spaces to + signs AFTER getting the URL.
| Code: | | if ($msg =~/^#google (.*)$/)<br /> {<br /> $1 =~ s/ /+/g;<br /> $self->Sendmsg ("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=$1", Font => "Verdana", Effect => "B");<br /> } |
_________________ Current Site (2008) http://www.cuvou.com/ |