spacer

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

home / experts / xml / column57

Google SVG Search III

C/C++ Developer (NYC)
Next Step Systems
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use


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

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
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/column57/2.html
Created: Jun 10, 2002
Revised: Jun 10, 2002