Hi,

I am new to php and tried to test googlesearch.php file (as attachment) from Chris Petersen. Which invokes nusoap.php file. I have all the necessary class files that nusoap.php included and put in the same directory with googlesearch.php and nusoap.php file. Also I have Google's licence key as well. But when executed googlesearch.php. It only displays the documentation of class.soapclinet.php and nothing else. Could anybody tell me what is the problem? Please help. Thanks,


Daniel


_________________________________________________________________
Get 10Mb extra storage for MSN Hotmail. Subscribe Now! http://join.msn.com/?pgmarket=en-hk
<?
/*

Google API


*/ require_once("nusoap.php");

class GoogleSearchResults {
   var $estimatedTotalCount;
   var $searchTime;
   var $startIndex;
   var $endIndex;
   var $results;
   var $directories;
}
class GoogleSearchResult {
   var $cachedSize;
   var $hostName;
   var $snippet;
   var $summary;
   var $title;
   var $url;
}

function googleSearch($query, $startIndex) {
   $soapclient = new soapclient("GoogleSearch.wsdl", "wsdl");
   $proxy = $soapclient->getProxy();
   $result = $proxy->doGoogleSearch(    "wzMXCPhQFHIoNdE1l1x/hsudArv9AceZ",
                       $query,
                       $startIndex,
                       10,
                       "false",
                       "",
                       "false",
                       "",
                       "latin1",
                       "latin1");

   $returnVal = new GoogleSearchResults();
   $returnVal->estimatedTotalCount = $result["estimatedTotalResultsCount"];
   $returnVal->searchTime = $result["searchTime"];
   $returnVal->startIndex = $result["startIndex"];
   $returnVal->endIndex = $result["endIndex"];
   $rerurnVal->results = array();

   $resultElements = $result["resultElements"];
   for($i=0; $i<count($resultElements); $i++) {
       $entry = new GoogleSearchResult();
       $entry->cachedSize = $resultElements[$i]["cachedSize"];
       $entry->hostName = $resultElements[$i]["hostName"];
       $entry->snippet = $resultElements[$i]["snippet"];
       $entry->summary = $resultElements[$i]["summary"];
       $entry->title = $resultElements[$i]["title"];
       $entry->url = $resultElements[$i]["URL"];
       $returnVal->results[$i] = $entry;
   }
   return $returnVal;
}

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to