Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

62 Part I — Basics


The resulting output for the Perl example is actually HTML. Listing 4-2 outlines the main
components of the returned structure (which contains the data that we know is returned) by
showing a dump of the hash structure returned by the call to the remote procedure. I’ve short-
ened it and re-formatted the structure to make easier to read.

Listing 4-2:A Dump of the Google Web API Remote Procedure Call

$VAR1 = bless( {
‘searchTime’ => ‘0.087767’,
‘endIndex’ => ‘10’,
‘searchComments’ => ‘’,
‘documentFiltering’ => 0,
‘searchTips’ => ‘’,
‘estimatedTotalResultsCount’ => ‘997’,
‘searchQuery’ => ‘MCslp’,
‘startIndex’ => ‘1’,
‘resultElements’ => [
bless( {
‘relatedInformationPresent’ => 1,
‘hostName’ => ‘’,
‘URL’ => ‘http://mcslp.com/’,
‘snippet’ => ‘All of them are under the
<b>MCslp</b> banner and all of them will,
<b>...</b> As with this<br> site, and indeed
all <b>MCslp</b> sites, all of the new blogs are free
to use and <b>...</b>’,
‘directoryCategory’ => bless( {
‘fullViewableName’ => ‘’,
‘specialEncoding’ => ‘’
}, ‘DirectoryCategory’ ),
‘summary’ => ‘’,
‘cachedSize’ => ‘44k’,
‘title’ => ‘<b>MCslp</b>’,
‘directoryTitle’ => ‘’
}, ‘ResultElement’ ),
...
],
‘directoryCategories’ => [],
‘estimateIsExact’ => 0
}, ‘GoogleSearchResult’ );

The primary keys of the hash contain the information about the search, in other words, the
base data, as described in Table 4-2. The resultElementsvalue is an array of individual
hashes. Each hash is an individual result, and the structure of each result matches the descrip-
tions given in Table 4-3.
Free download pdf