例 – Services_Google の基本的な使用法

Services_Google の基本的な使用法

Services_Google の基本機能の使用例を以下に示します。

Google で PEAR を検索

<?php
require_once 'Services/Google.php';
    
$google = new Services_Google($key);

$google->queryOptions['limit'] = 30;
$google->search("PEAR");

foreach (
$google as $key => $result) {
  echo 
"$key]\t$result->title\n";
}
?>

スペルチェック

<?php
require_once 'Services/Google.php';
    
$google = new Services_Google($key);

echo 
$google->spellingSuggestion("wahll")."\n";
?>