Coder Social home page Coder Social logo

josepbidegain / google-search-results-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from serpapi/google-search-results-php

0.0 1.0 0.0 26 KB

Google Search Results PHP API via Serp Api

Home Page: https://serpapi.com

License: MIT License

Makefile 3.47% PHP 96.53%

google-search-results-php's Introduction

Google Search Results in PHP

Build Status

This Php API is meant to scrape and parse Google results using SerpApi.

Feel free to fork this repository to add more backends.

The full documentation is available here.

Installation

Php 7+ must be already installed and composer dependency management tool.

Simple Example

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

Set SerpApi key

$serp = new GoogleSearchResults();
$serp->set_serp_api_key("Your Private Key");

Or

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

Example with all parameters 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);

This service supports Google Images, News, Shopping. 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 full documentation is available here.

Author: Victor Benarbia [email protected] For more information: https://serpapi.com

Thanks Rest API for Php

google-search-results-php's People

Contributors

atefbb avatar exfriend avatar hartator avatar jvmvik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.