Google AJAX Search API

    Maybe I'm an idiot, and kill someone, but today I accidentally, having interrupted the greater half of the Internet, discovered that Google has a powerful and absolutely free search API . Which, well, is just mega elementary to integrate with your site. but what came of it
    $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;
    }


    Also popular now: