Download the PHP package serpapi/google-search-results-php without Composer
On this page you can find all versions of the php package serpapi/google-search-results-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download serpapi/google-search-results-php
More information about serpapi/google-search-results-php
Files in serpapi/google-search-results-php
Package google-search-results-php
Short Description Scrape Google, Bing, Baidu, Ebay, Youtube, Walmart, Yandex search result at scale using SerpApi.com
License MIT
Homepage http://github.com/serpapi/google-search-results-php
Informations about the package google-search-results-php
Google Search Results in PHP
This PHP API is meant to scrape and parse Google, Bing or Baidu results using SerpApi.
The full documentation is available here.
The following services are provided:
SerpApi provides a script builder to get you started quickly.
Installation
Php 7+ must be already installed and composer dependency management tool.
Package available from packagist.
Quick start
if you're using composer, you can add this package (link to packagist).
Then you need to load the dependency in your script.
if not, you must clone this repository and link the class.
Get "your secret key" from https://serpapi.com/dashboard
Then you can start coding something like:
This example runs a search about "coffee" using your secret api key.
The SerpApi service (backend)
- searches on Google using the query: q = "coffee"
- parses the messy HTML responses
- return a standardizes JSON response The Php class GoogleSearch
- Format the request to SerpApi server
- Execute GET http request
- Parse JSON into Ruby Hash using JSON standard library provided by Ruby Et voila..
Alternatively, you can search:
- Bing using BingSearch class
- Baidu using BaiduSearch class
- Ebay using EbaySearch class
- Yahoo using YahooSearch class
- Yandex using YandexSearch class
- Walmart using WalmartSearch class
- Youtube using YoutubeSearch class
- HomeDepot using HomeDepotSearch class
- Apple App Store using AppleAppStoreSearch class
- Naver using NaverSearch class
See the playground to generate your code. https://serpapi.com/playground
Example
- How to set SERP API key
- Search API capability
- Location API
- Search Archive API
- Account API
- Search Google Images
- Generic SerpApiClient
- Example by specification
- Composer example
How to set SERP API key
The SerpApi api_key can be set globally using a singleton pattern.
Or
Search API capability
Location API
it prints the first 3 location matching Austin (Texas, Texas, Rochester)
Search Archive API
Let's run a search to get a search_id.
Now let's retrieve the previous search from the archive.
it prints the search from the archive.
Account API
it prints your account information.
Search Google Images
this code prints all the images links, and download image if you un-comment the line with wget (linux/osx tool to download image).
Example by specification
The code described above is tested in the file test.php and example.php. To run the test locally.
Composer example
see: https://github.com/serpapi/google-search-results-php/example_composer/
To run the code.
- git clone https://github.com/serpapi/google-search-results-php
- cd google-search-results-php/example_composer/
- make API_KEY=
all
Change log
- 2.0
- Code refractoring SearchResult -> Search
- Add walmart and youtube search engine
- 1.2.0
- Add more search engine
- 1.0
- First stable version
Conclusion
- First stable version
SerpApi supports all the major search engines. Google has the more advance support with all the major services available: Images, News, Shopping and more.. To enable a type of search, the field tbm (to be matched) must be set to:
- isch: Google Images API.
- nws: Google News API.
- shop: Google Shopping API.
- any other Google service should work out of the box.
- (no tbm parameter): regular Google search. The field tbs allows to customize the search even more.
The full documentation is available here.
Author: Victor Benarbia [email protected] For more information: 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
All versions of google-search-results-php with dependencies
ext-curl Version *
ext-json Version *