You are here: Re: google SOAP API « PHP Programming Language « IT news, forums, messages
Re: google SOAP API

Posted by Damo_Suzuki on 11/05/06 16:22

how would i go about that. this is the code i have

# Set parameters
$parameters = array(
'key'=>'xxxxxxxxxxxxxxxxxxxxxxxxxx',
'q' => $queryterm,
'start' => '0',
'maxResults' => '10',
'filter' => 'false',
'restrict' => '',
'safeSearch' => 'false',
'lr' => '',
'ie' => 'latin',
'oe' => 'latin'
);

# Create a new SOAP client, feeding it GoogleSearch.wsdl on Google's
site
$soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl',
'wsdl');

# query Google
$results = $soapclient->call('doGoogleSearch',$parameters);

# Results?
if ( is_array($results['resultElements']) ) {
print "<p>Your Google query for '" . $queryterm . "' found "
.. $results['estimatedTotalResultsCount'] . " results, the top ten of
which
are:</p>";
foreach ( $results['resultElements'] as $result ) {
print
"<p><a href='" . $result['URL'] . "'>" .
( $result['title'] ? $result['title'] : 'no title' ) .
"</a><br />" . $result['URL'] . "<br />" .
( $result['snippet'] ? $result['snippet'] : 'no snippet' ) .
"</p>";
}
}

# No Results
else {
print "Your Google query for '" . $queryterm. "' returned no
results";
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация