Simple Example - Google Spell check - no worky

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>";
    }

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux