Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vijay Immanuel  >  Google API Access for PHP  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example to use this library for Google spelling suggestion
Class: Google API Access for PHP
PHP class library to access the Google API viaSOAP
Author: By
Last change:
Date: 2002-12-22 14:41
Size: 626 bytes
 

Contents

Class file image Download
<?php

/*
* Example to access Google spelling suggestion through GoogleSearch for PHP.
*/

require_once 'GoogleSearch.php';

$gs = new GoogleSearch();

//set Google licensing key
$gs->setKey("your_google_authentication_key");


$gs->setSpellingSuggestionPhrase("googgle saerch");

//perform spelling suggestion
$spell_result $gs->doSpellingSuggestion();

//check for errors
if(!$spell_result)
{
    if(!
$err $gs->getError())
    {
        echo 
"<br>No spelling suggestions necessary.<br>";
    }
    else
    {
        echo 
"<br>Error: " $err;
    }
}
else
{
    echo 
"<br>Suggested Spelling: " $spell_result;
}

?>