AOW >> Google search engine API 2016
search-marketing

Google search engine API 2016

Use Google search engine API is not very difficult. Now we let you know about how you will able to use the Google API.

Use Google search engine API | Google search API | integrate Google search in website | integrate Google search using PHP search using PHP.Use Google search engine API, Google API, Google search API, Google search, integrate Google search in the website, integrate Google search using PHP, Google search using PHP

What is Google search engine API?

Google search engine API is the script OR code which can be integrated into any website for searching purpose.

What Google search engine API do?

Google search engine API will make you able to search anything on your website like you search on google.

google search engine api

Follow the following steps for using the API:

  • Make a simple form in HTML with one input text field with one submit button.
<html>
 <body>
  <form action="searching.php" method="get">
   <input type="text" name="query" value="" /><br />
   <input type="submit" name="submit" value="Submit" />
  </form>
 </body>
</html>
  • After the copy, the below code and save it in the searching.php named file.
<?php
if(empty($_POST['query'])) exit;
$query=str_replace(" ", "+", $_POST['query']);
  $url="http://suggestqueries.google.com/complete/search?output=ie8&client=ie8&q=".$query;
$ch = curl_init();
$timeout = 30;
curl_setopt ($ch, 
CURLOPT_URL, $url); 
curl_setopt ($ch, 
CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, 
CURLOPT_CONNECTTIMEOUT, $timeout);
$response = curl_exec($ch);
curl_close($ch); 
///Write out the response
$response=str_replace("<?xml version=1.0?><SearchSuggestion version=2.0 xmlns=http://opensearch.org/searchsuggest2><Query>", "", $response);
$response=str_replace('<?xml version="1.0"?><SearchSuggestion version="2.0" xmlns="http://opensearch.org/searchsuggest2"><Query>', "", $response);
$response=str_replace($_POST['query']."</Query><Section title=Google Suggestions>", "", $response);
$response=str_replace($_POST['query'].'</Query><Section title="Google Suggestions">', "", $response);

$response=str_replace('<Image source="/images/cleardot.gif" alt="f" width="1" height="1" align="middle"/>', "", $response);
$response=str_replace('<Image source=/images/cleardot.gif alt=f width=1 height=1 align=middle/>', "", $response);
echo $response;

?>
  • The above-given script will take the keywords/query from the user and send it to the Google and get the searching result against the keywords/query and show.

Hope you enjoy this.

If you face any problem, OR you want to discuss anything with us, please let us know we are here for your help.

Thanks!

Likes(0)Dislikes(1)
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *


*