topical media & game development 
  
 
 
 
 
  
    
    
  
 server-webapi-code-06-nusoap.simple.php / php
  <html>
  <head>
  <title>Simple Search Interface</title>
  </head>
  <body>
  <form action="" method="get">
  <input type="hidden" name="start" value="0">
  <input type="text" name="query" value="">
  <input type="submit">
  </form>
  <br>
  <?php
  require ("../common_db.php");
  
  if (isset(searchQuery = html_entity_decode(start = client = new soapclient("http://api.google.com/search/beta2", false);
    client->getError()) 
    {
            echo "Error creating client <pre>" . client->soap_defencoding = 'UTF-8';
    
    client, start);
    searchQuery);
    
    
    if (result); 
            echo '</pre>';
    } else {
          
            if (client->getError() . '</pre>';
            } else 
            {
                    searchQuery);
              echo "<b>Search Query</b>: <i>" . x = y = result['estimateIsExact'])
        {
          echo "Displaying results y, out of " . x to result['estimatedTotalResultsCount'] . " results<br>";
        }
        result['resultElements'];
        if (count(queryResults as item['URL']}\">{item['snippet'] . "<br><br>\n";
          }
        }else
        {
          echo "No results to display";
        } 
        result['endIndex'];
        echo "<br><br>";
        
        echo "<a href=\"./nusoap.simple.php?query={nextStart\">Next 10 Results</a>";
      }
    }
  }
  
  function runGoogleSearch(searchQuery, query = array(
            'key'=>'u6U/r39QFHK18Qcjz/XdWSbptVaj9k1t',
            'q'=>"site:preinheimer.com " . start,
            'maxResults'=>10,
            'filter'=>true,
            'restrict'=>'',
            'safeSearch'=>true,
            'lr'=>'',
            'ie'=>'',
            'oe'=>''
    );
    
    client->call("doGoogleSearch", result;
  }
  
  function getGoogleResults(searchQuery, key = md5(searchQuery);
    // Check for recent items
    key' AND ((NOW() - `time`) < 84600)";
    query);
    
    //print_r(
    if (count(results) > 0)
    {
      //echo "Using Cached Data";
      //Cache exists and is recent, Create object to return
      result['estimateIsExact'] = result['estimatedTotalResultsCount'] = result['startIndex'] = searchResultQuery = "SELECT * FROM 06_google_cache WHERE `query` = 'start'";
      searchResultQuery);
      start + count(result['resultElements'] = result;
    }else
    {
      //Save results
      client, start);
      
      if (result;
      } else {
            
              if (result;
              } else 
              {
                queryResults = query = mysql_escape_string(index = 0;
                      
                      key', 'start', '{result['estimatedTotalResultsCount']}', null)";
                      insertQuery(queryResults) > 1)
                      {
            foreach(item)
            {
              
              item['URL']);
              item['snippet']); 
              item['title']);
              start . query);
              
              key', 'query', 'snippet', 'url')";
              replaceQuery(linkID);
              result;
        }
      }
    }
    
  }
  
  function getSuggested(suggestions = array();
    query);
    query AS word = mysql_real_escape_string(linkID);
      word'";
      query, 2);
      if (count(suggest as suggestions[] = suggestions;
  }
  
  ?>
  </body>
  </html>
  
  
(C) Æliens 
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. 
In case of other copyright issues, contact the author.