In mare parte am rezolvat!
Ascultand sfatul lui Criti am folosit API si o clasa pentru aceasta: http://dietrich.ganx4.com/nusoap/
Numai ca numarul rezultatelor nu este corect, acesta fiind mult mai mic decat real.
Take a look: http://kw.gexge.com/info.php
Sursa:
Cod:
<html>
<head>
<title>googly.php</title>
</head>
<body>
<h1>Googly</h1>
<form method="GET">
Query: <input name="query" value="<? print $HTTP_GET_VARS['query'] ?>">
<input type="submit" name="Search">
</form>
<?
# Run the search only if you're provided a query to work with.
if ($HTTP_GET_VARS['query']) {
# Use the NuSOAP php library.
require_once('nusoap.php');
# Set parameters.
$parameters = array(
'key'=>'z00000000000008Zawd00000000etXaj',
'q' => $HTTP_GET_VARS['query'],
'start' => 0,
'maxResults' => 10,
'filter' => false,
'restrict' => '',
'safeSearch' => false,
'lr' => 'lang_ro',
'ie' => '',
'oe' => ''
);
# Create a new SOAP client, feeding it GoogleSearch.wsdl on Google's site.
$soapclient = new soapclient("http://api.google.com/search/beta2");
# Query Google.
$results = $soapclient->call('doGoogleSearch',$parameters, 'urn:GoogleSearch',
'urn:GoogleSearch');
# Results?
if ( is_array($results['resultElements']) ) {
echo " q => cuvant cautat, <br> start => 0, maxResults => 10, <br> filter => false, <br> restrict => , <br> safeSearch => false, <br> lr => lang_ro, <br> ie => , <br> oe => ";
print "<p>Your Google query for '" . $HTTP_GET_VARS['query'] . "' 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 '" . $HTTP_GET_VARS['query'] . "' returned no results";
}
}
?>
</body>
</html>