• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

Check if keyword has any result using Google AJAX API

This is function to check if there are any google search results on the given keyword. You only need to modify it to insert your google API key.

function check_result($keyword)
    //your google API key
    $key = "";
    $url = "".

    // sendRequest 
    // note how referer is set manually 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_REFERER, $_SERVER['SERVER_NAME']); 
    $body = curl_exec($ch); 

    // now, process the JSON string 
    $json = json_decode($body); 
            return false; 
            return true; 


You may also be interested in:

Powered by

blog comments powered by Disqus