Simple Example - Google Spell check - no worky
| From: | Blaine Lang | Date: | Sat, 06 Dec 2003 05:03:45 +0000 |
| Subject: | Simple Example - Google Spell check - no worky | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1205@lists.php.net to get a copy of this message | ||
I've been trying to also get a simple PEAR:SOAP example to work. Many of the
PHP SOAP examples online that I've seen from my googling are nusoap based..
I think the most basic example is the google spellcheck lookup for search
queries. This the feature that comes back with a "Suggested" site or
spelling for what your looking for.
The code below is not returning a suggestion - no errors - but it just
returns what I send.
I had the same code in nusoap running in a few min -- and then came back
again to take a wack at making it work with PEAR:SOAP.
Still no luck ...
I can see from the posts -- there are a lot of newbies having similar
problems. I'd like to help - if I can get a few examples working.
// include the class
require_once 'SOAP/Client.php';
// create a instance of the SOAP client object
$soapclient = new SOAP_Client('http://api.google.com/search/beta2');
// set up an array containing input parameters to be
// passed to the remote procedure
$parms = array(
'key' => $devKey, // Googlelicense key
'phrase' => $_POST['p'] // term to check
);
// invoke the method on the server
$result =
$soapclient->call('doSpellingSuggestion',$parms,'urn:GoogleSearch');
if (!PEAR::isError($result)) {
echo "Google suggests <b>" . $result . "</b> for the term
<b>" .
$_POST['p'] . "</b><br>";
} else {
echo "No result or NULL returned<br>";
}