x-fran / g-trends

Google Trends API for PHP
https://tarlabs.es
MIT License
113 stars 47 forks source link

interestOverTime() Method error 400 in client status code #19

Closed Daddaniele closed 5 years ago

Daddaniele commented 5 years ago

HI, the problem seems to be the same in #14 trying to call interestOverTime(),

var_dump($gt->interestOverTime('Whatever i search'))

i get bool(false)

gtrends installed via composer ( today ) with

$ composer require x-fran/g-trends

php7.something

Could you please kindly provide your working string ( as for #14 reply ) ? also tried var_dump($gt->interestOverTime(['Something'])) same result

the problem seems to be here $data = $this->_getData(self::GENERAL_ENDPOINT, 'GET', $payload);

where self::GENERAL_ENDPOINT is https://trends.google.com/trends/api/explore but in function _getData()

$statusCode = $client->getResponse()->getStatusCode(); var_dump($statusCode)

returns int(400)

antaresua commented 5 years ago

the problem is inside function interestOverTime() line 358... if you will use language other than english you will get error... you need to use 'id' instead 'title' in this method...