spacer

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

home / experts / xml / column57

Google SVG Search III

Technical Lead
Thomson Reuters (Markets) LLC
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?


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

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

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