<?php /**/ ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <title>GoogleSearch.php (pear SOAP_Client)</title>
  </head>
  <body>
  <?php
  ini_set(
    'include_path',
      ini_get( 'include_path' ) . PATH_SEPARATOR . "/home/rdhyee/pear/lib/php" . PATH_SEPARATOR . '/usr/local/lib/php'
      );
  require 'SOAP/Client.php';

  $google = new SOAP_Client('http://api.google.com/search/beta2'); 

$query = "Bach";
$params = array(
  new SOAP_Value('key',        'string',  'X1aouJfkHBmo11Bc2LEv0GxdQogHFex1'),
  new SOAP_Value('q',          'string',  $query),
  new SOAP_Value('start',      'int',     0),
  new SOAP_Value('maxResults', 'int',     10),
  new SOAP_Value('filter',     'boolean', false),
  new SOAP_Value('restrict',   'string',  ''),
  new SOAP_Value('safeSearch', 'boolean', false),
  new SOAP_Value('lr',         'string',  'lang_en'),
  new SOAP_Value('ie',         'string',  ''),
  new SOAP_Value('oe',         'string',  ''));

$hits = $google->call('doGoogleSearch', $params, 'urn:GoogleSearch');

foreach ($hits->resultElements as $hit) {
    printf('<a href="%s">%s</a><br />', $hit->URL, $hit->title);
}
  ?>
  </body>
</html>
