spacer

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

home / experts / xml / column57

Google SVG Search III

Java Software Engineer / Architect Sr (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume
Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans


The result page is as straight-forward, including the embed tag for the SVG with a properly generated URL to trigger the Perl script again to fill in the results:

    print <<EOF;
content-type: text/html

<html><head><title>Search Results</title></head>
<body><h1>Search Results</h1>
<embed src="?q=$query&p=svg" name="results" width="600" height="600"
type="image/svg+xml" pluginspage="http://www.adobe.com/svg/viewer/install/">
</embed></body></html>
EOF

Search Results


And last but not least we change the existing code for generating SVG to use standard output for feeding back the results instead of writing them to a file:

    my $googleSearch = SOAP::Lite->service('file:GoogleSearch.wsdl');
    my $key = '00000000000000000000000000000000';
    $ENV{HTTP_proxy} = 'http://proxy:3128'; # if necessary
    my $result = $googleSearch->doGoogleSearch($key, $query, 0, 10, 'false', '', 'false', '', 'latin1', 'latin1');
    
    my $i = 0;
    my $svg = new SVG;
    foreach my $e (@{$result->{'resultElements'}}) {
      svgelement($i, $svg, $e->{'summary'}, $e->{'title'}, $e->{'URL'}, $e->{'directoryCategory'}->{'fullViewableName'}, $e->{'directoryTitle'}, $e->{'snippet'});
      $i++;
    }
    print "content-type: image/svg+xml\n\n";
    print $svg->render();
  }

With these simple modifications we turned our stand-alone Perl script into a CGI. The CGI module comes with a stand-alone mode mainly used for debugging, where you can still call the script from the command line and manually supply parameters. Download the script (not including WebReference site specifics) or try it online to see for yourself!


Produced by Michael Claßen


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger

URL: http://www.webreference.com/xml/column57/2.html
Created: Jun 10, 2002
Revised: Jun 10, 2002