spacer

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

home / experts / xml / column57

Google SVG Search III

Vice President of Risk Technology - READY TO HIRE! (NYC)
Next Step Systems
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

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