Perl5.3.4 Google SOAP |
30.09.2008 |
| ← 5.3.3 SOAP Array | [ up ] - [ a - z ] - [ search PC ] - [ top ] | 5.3.5 SOAP Examples → |
5.1 RSS 2.0 5.2 XML RPC 5.2.1 XML::Parser 5.3 SOAP 5.3.1 SOAP Error Handling 5.3.2 SOAP Basic Authorization 5.3.3 SOAP Array 5.3.4 Google SOAP 5.3.5 SOAP Examples 5.4 eBay API 5.4.1 Example: get Ebay Time
Google API (Search)
Your license key provides you access to the Google Web APIs service and entitles you to 1,000 queries per day.
Download: → files/google search pl.txt
#!/usr/bin/perl -w use strict; use SOAP::Lite; my $key = 'UxUxUxUxUxUxUxUxUxUxUxUxUxUxUxUx'; my $query = $ARGV[0] || "foo"; my $googleSearch = SOAP::Lite -> service("file:GoogleSearch.wsdl"); my $result = $googleSearch -> doGoogleSearch($key, $query, 0, 10, "false", "", "false", "", "latin1", "latin1"); print "About $result->{'estimatedTotalResultsCount'} results.\n"; foreach my $entry (@{$result->{'resultElements'}}) { print "- $entry->{title} \t$entry->{URL}\n"; } __END__ # http://api.google.com/GoogleSearch.wsdl # http://www.google.com/apis/reference.html
[ http://interconnected.org/home/more/GoogleSearch.pl.txt ]
How to use the WSDL File
The WSDL file provides a standard description of Google's search services. The file is included with this kit, and is also at
http://api.google.com/GoogleSearch.wsdlMany programming languages now understand WSDL and can use this file to automatically invoke Google's API. For example, the WSDL can be imported into .NET, converted into Java code using Apache Axis WSDL2Java, or used directly by Perl SOAP::Lite. The WSDL file has been tested with SOAP::Lite 0.52, the .NET Framework, (via "Add Web Reference" or wsdl.exe version 1.0.3705.0), and Apache Axis Beta 1.
Below is a simple Perl script to use the WSDL file to do a query:
use SOAP::Lite; my $key='000000000000000000000000'; my $query="foo"; my $googleSearch = SOAP::Lite -> service("file:GoogleSearch.wsdl"); my $result = $googleSearch -> doGoogleSearch($key, $query, 0, 10, "false", "", "false", "", "latin1", "latin1"); print "About $result->{'estimatedTotalResultsCount'} results.\n";
| ← 5.3.3 SOAP Array | [ up ] - [ top ] | 5.3.5 SOAP Examples → |
[ home ] - [ search ] - [ feedback ]
copyright by reto - created with mytexi