This Php API is meant to scrape and parse Google results using SerpApi. Feel free to fork this repository to add more backends.
Assuming Php 7+ is already installed and composer dependency managemen tool.
require 'path/to/google_search_results'
$serp = new GoogleSearchResults("demo");
$result = $serp(["q" => "coffee","location"=>"Austin,Texas"]);
$serp = GoogleSearchResults()
$serp.set_serp_api_key("Your Private Key")
Or
$serp = new GoogleSearchResults("Your Private Key")
$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
- Travis Dent - https://github.com/tcdent/php-restclient
- Test framework - PhpUnit - https://phpunit.de/getting-started/phpunit-7.html