Docsity

Google Web API: Accessing Google Search Results using SOAP and Perl, Slides of Information Security and Markup Languages

Partial preview of the text

Download Google Web API: Accessing Google Search Results using SOAP and Perl and more Slides Information Security and Markup Languages in PDF only on Docsity!

Web-based APIs

Google Web Search API

  • Google currently has a free Web Service interface

for users registered before December 2006.

  • Up to 1000 requests per day per user.
  • Defined using WSDL, using HTTP-SOAP.
  • Every user must first request a unique key to

track user activity, and provide this key with every

request.

  • Requests can be for search results, cached data or

spelling checks.

Google WSDL 2/

Google SOAP Request

00000000000000000000000000000000
uct computer science
0
10
false
false
latin1
latin1

Google SOAP Response 2/

true

http://hci.stanford.edu/cs147/examples/sh

rdlu/

<b>SHRDLU</b>

3

1 true shrdlu winograd maclisp teletype

Using Google API from Perl

use SOAP::Lite;

create soap object

my $key=โ€˜000000000000000000000000000000โ€™;

my $query="uct computer science";

my $googleSearch = SOAP::Lite -> service("file:./GoogleSearch.wsdl")

-> proxy ('http://api.google.com/search/beta2', proxy => ['http' => 'http://cache.uct.ac.za:8080']);

submit to server and get results / retry while request not accepted

my $result;

my $max_retries = 0;

my $retry_count = 0;

while (!$results->{resultElements} && $retry_count <= $max_retries)

{

eval { $result = $googleSearch -> doGoogleSearch( $key, $query, 0, 10, "false", "", "false", "", "latin1", "latin1"); }; $retry_count++;

}

print out titles and URLs

foreach my $aresult (@{$result->{'resultElements'}})

{

print (sprintf ("%s\n URL: %s\n", $aresult->{'title'}, $aresult- >{'URL'}));

}

Beyond Google Web Search

  • Other Google Web APIs
    • Google Maps
    • Google Earth
    • etc.
  • Google RSS/Atom feeds for GMail.
  • MSN and Yahoo Web APIs.

Amazon Electronic Commerce

  • A full suite of Web Services to interface with

Amazon.com

  • Both SOAP and REST (URL-encoded) interfaces
  • Many more interfaces than Google. Why?
  • Fewer restrictions on usage, in production and

free for many purposes!

Output from Amazon 1/

0XJBJRVTVME4XENAVPQS
0.0196020603179932
True
0620056886

Output from Amazon 2/

0620056886

http://www.amazon.com/exec/obidos/redirect?tag=ws%26link_code=xm2%26camp= 25%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fA SIN=0620056886%2526tag=ws%2526lcode=xm2%2526cID=2025%2526ccmID=165953% 26location=/o/ASIN/0620056886%25253FSubscriptionId=

Andrew Verster

Zuleikha Mayat

Dennis Bughwan

Nalin Bughwan

Domain Enterprises

Book

Indian Delights