How to scan data like google?

Asked

Viewed 66 times

-1

Good evening as I can make an application that basically works like google, I want to type a keyword and get results on, or pull data from google itself, which language and path should I use?

  • like google search? or google bigquery? google has several tools.

  • like google search engine

1 answer

1

You can use the API https://developers.google.com/custom-search/, so can use with "any language", since it works via HTTP request.

Reference: https://developers.google.com/custom-search/json-api/v1/using_rest

if (!empty($_GET['q'])) {

    $busca = $_GET['q'];

    $url = 'https://www.googleapis.com/customsearch/v1?key=<SUA CHAVE DA API>&cx=<SUA CHAVE CX>&q=' . rawurlencode($busca);

    $body = file_get_contents($url);
    $json = json_decode($body);

    if ($json->items){
       foreach ($json->items as $item){
          print_r($item);
       }
    }
}

To generate the CX key go this link: https://developers.google.com/custom-search/json-api/v1/overview#Cx

To generate the API key at this link: https://developers.google.com/custom-search/json-api/v1/overview

Note that google provides 100 free queries per day, for more queries you will have to see the paid plan that currently (27/04/2018) costs $5 (I believe in dollars) for every 1000 queries.

Paid plan: https://developers.google.com/console/help/#Billing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.