📜 ⬆️ ⬇️

Google AJAX Search API

Maybe I'm an idiot, and kill me someone, but today, quite by chance, I interrupted more than half of the Internet and found that Google has a powerful and completely free API for searching. That well, just mega elementary integrate with your site.
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=".urlencode($query)";
$body = file_get_contents($url);
$json = json_decode($body);
foreach ($json->responseData->results as $resultjson) {
$result_google['urls']= $resultjson->url;
$result_google['contents'] = $resultjson->content;
}

but what came out of it

')

Source: https://habr.com/ru/post/25950/


All Articles