exfriend / google-search-results-php

Google Search Results PHP API via Serp Api

Home Page:https://serpapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Search Results in PHP

This Php API is meant to scrape and parse Google results using SerpApi. Feel free to fork this repository to add more backends.

Installation

Assuming Php 7+ is already installed and composer dependency managemen tool.

Simple Example

require 'path/to/google_search_results'
$serp = new GoogleSearchResults("demo");
$result = $serp(["q" => "coffee","location"=>"Austin,Texas"]);

Set SERP API key

$serp = GoogleSearchResults()
$serp.set_serp_api_key("Your Private Key")

Or

$serp = new GoogleSearchResults("Your Private Key") 

Example with all params and all outputs

$query = [
  "q" =>  "query",
  "google_domain" =>  "Google Domain", 
  "location" =>  "Location Requested", 
  "device" =>  device,
  "hl" =>  "Google UI Language",
  "gl" =>  "Google Country",
  "safe" =>  "Safe Search Flag",
  "num" =>  "Number of Results",
  "start" =>  "Pagination Offset",
  "serp_api_key" =>  "Your SERP API Key"
];

$serp = new GoogleSearchResults("private key");

$html_results = $serp.html($query);
$json_results = $serp.json($query);
$json_results_with_images = $serp.json_with_images($query);

Author: Victor Benarbia For more information: see https://serpapi.com

Thanks Rest API for Php

About

Google Search Results PHP API via Serp Api

https://serpapi.com

License:MIT License


Languages

Language:PHP 96.5%Language:Makefile 3.5%