<?php require_once('SOAP/Client.php'); ?>
<?php
$endpoint = 'http://api.google.com/search/beta2';
$client =& new SOAP_Client($endpoint);
?>
<?php
$key = 'xxxx';
$query = 'Caraveo';
$start = 0;
$maxResults = 4;
$filter = false;
$restrict = '';
$safeSearch = false;
$lr = '';
$ie = '';
$oe = '';
?>
<?php
$response = $client->call('doGoogleSearch',
$params = array('key'=>$key,
'q'=>$query,
'start'=>$start,
'maxResults'=>$maxResults,
'filter'=>$filter,
'restrict'=>$restrict,
'safeSearch'=>$safeSearch,
'lr'=>$lr,
'ie'=>$ie,
'oe'=>$oe),
array('namespace'=>'urn:GoogleSearch'));
?>
<?php
foreach($response->resultElements as $result) {
echo '<a href="'.$result->URL.'">';
echo $result->title."</a><br><br>\n";
echo $result->snippet."<br><br><br>\n";
}
?>