<?php
require_once('SOAP/Client.php');
$key = 'xxxxxxxxxxxx';
$query = 'Caraveo';
$client = new SOAP_Client('http://api.google.com/search/beta2');
$response = $client->call('doGoogleSearch',
array($key,$query,0,10,false,'',false,
'','',''),
array('namespace'=>'urn:GoogleSearch'));
foreach($response->resultElements as $result) {
echo '<a href="'.$result->URL.'">'.$result->title."</a><br><br>\n";
echo $result->snippet."<br><br><br>\n";
}
?>
But this is still wrong...the soap library cannot determine what to call anything:
<?php
require_once('SOAP/Client.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','');
$client = new SOAP_Client('http://api.google.com/search/beta2');
$response = $client->call('doGoogleSearch',
array($key,$query,$start,$maxResults,
$filter,$restrict,$safeSearch,
$lr,$ie,$oe),
array('namespace'=>'urn:GoogleSearch'));
foreach($response->resultElements as $result) {
echo '<a href="'.$result->URL.'">'.$result->title."</a><br><br>n";
echo $result->snippet."<br><br><br>\n";
}
?>