spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / xml / column55

Google SVG Search I

Web Design Manager
IT Search
US-NE-Kimball

Justtechjobs.com Post A Job | Post A Resume
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

More search parameters

The following parameters handle scrolling through the result set, the character encoding of documents, and several search options:

ParameterValueDescription
start0The offset into the result set
maxResults10The number of elements to be returned
filterfalseshow similar results
restrict''Restriction by country or topic
safeSearchfalseshow all results
lr''Language restriction
ie'latin1'Input character encoding
oe'latin1'Output character encoding

Parsing the results

The result variable is created on the fly according to the response type for the doGoogleSearch call. In this case it is a top-level hashtable containing an array resultElements, which in turn holds a hashtable with information for each search result, such as summary, title, and URL. It also contains a further hashtable with directory information from the Open Directory if present. We can easily print the structure with the following code:

foreach my $element (@{$result->{'resultElements'}}) {
  foreach my $key (keys(%$element)) {
    print $key, ': ', $element->{$key}, "\n";
  }
}

This produces a printout looking like this:

summary: Articles, columns, tools and resources.
title: <b>exploring</b> <b>XML - The Webmaster's Reference on <b>XML</b>:
  Free Tutorials <b>...</b>
hostName:
URL: http://www.webreference.com/xml/
directoryCategory: DirectoryCategory=HASH(0x863cca8)
cachedSize: 42k
relatedInformationPresent: 1
directoryTitle: Webreference.com: Xploring <b>XML</b>
snippet: Hack into the jungle of this hot new markup language with Exploring XML, a bi-weekly 
  column featuring tutorials, examples and training in XML, XSL style <b>...</b>
...

Conclusion

In less than ten lines of code we managed to query Google's search engine and print out the results. In the next installment we will pick out the most relevant bits and turn them into a graphical representation using SVG. Hope you will be with me then again, bye for now!


Produced by Michael Claßen

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags

URL: http://www.webreference.com/xml/column55/2.html
Created: Apr 29, 2002
Revised: Apr 29, 2002