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 
=& new SOAP_Value('key','string','xxxx');
$query =& new SOAP_Value('q','string','Caraveo');
$start =& new SOAP_Value('start','int',0);
$maxResults =& new SOAP_Value('maxResults','int',4);
$filter =& new SOAP_Value('filter','boolean',false);
$restrict =& new SOAP_Value('restrict','string','');
$safeSearch =& new SOAP_Value('safeSearch','boolean',false);
$lr =& new SOAP_Value('lr','string','');
$ie =& new SOAP_Value('ie','string','');
$oe =& new SOAP_Value('oe','string','');
?>

Make the SOAP Call

<?php
$response 
$client->call('doGoogleSearch',
                          
$params 
                            array(
$key,$query,$start,$maxResults,
                                
$filter,$restrict,$safeSearch,
                                
$lr,$ie,$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";
}
?>