root/WebService-Google-Suggest/trunk/README

Revision 1503 (checked in by miyagawa, 16 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 NAME
2     WebService::Google::Suggest - Google Suggest as an API
3
4 SYNOPSIS
5       use WebService::Google::Suggest;
6
7       my $suggest = WebService::Google::Suggest->new();
8       my @suggestions = $suggest->complete("goog");
9       for my $suggestion (@suggestions) {
10           print "$suggestion->{query}: $suggestion->{results} results\n";
11       }
12
13 DESCRIPTION
14     WebService::Google::Suggest allows you to use Google Suggest as a Web
15     Service API to retrieve completions to your search query or partial
16     query. This module is based on Adam Stiles' hack
17     (http://www.adamstiles.com/adam/2004/12/hacking_google_.html).
18
19 METHODS
20     new
21           $suggest = WebService::Google::Suggest->new();
22
23         Creates new WebService::Google::Suggest object.
24
25     complete
26           @suggestions = $suggest->complete($query);
27
28         Sends your $query to Google web server and fetches suggestions for
29         the query. Suggestions are in a list of hashrefs, for example with
30         query "Google":
31
32           @suggestions = (
33             { query => "google", results => 122000000 },
34             { query => "google toolbar", results => 2620000 },
35             ...
36           );
37
38         Note that "results" value does NOT contain commas and "results"
39         text.
40
41     ua
42           $ua = $suggest->ua;
43
44         Returns underlying LWP::UserAgent object. It allows you to change
45         User-Agent (Windows IE by default), timeout seconds and various
46         properties.
47
48 AUTHOR
49     Tatsuhiko Miyagawa <miyagawa@bulknews.net>
50
51     This library is free software; you can redistribute it and/or modify it
52     under the same terms as Perl itself.
53
54     This module gives you NO WARRANTY.
55
56 SEE ALSO
57     http://www.adamstiles.com/adam/2004/12/hacking_google_.html
58
59     http://www.google.com/webhp?complete=1&hl=en
60
61     http://labs.google.com/suggest/faq.html
62
Note: See TracBrowser for help on using the browser.