Include the SOAP Client

<?php require_once('SOAP/Client.php'); ?>

Create the SOAP Client

<?php
$endpoint 
'http://api.google.com/search/beta2';
$client =& new SOAP_Client($endpoint);
?>

Prepare the Data

<?php
$key 
'xxxx';
$query 'Caraveo';
$start 0;
$maxResults 4;
$filter false;
$restrict '';
$safeSearch false;
$lr '';
$ie '';
$oe '';
?>

Make the SOAP Call

<?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'));
?>

Do something with the results

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