Skip to content

Commit

Permalink
fix parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
x-fran committed Feb 7, 2020
1 parent 9aa18cf commit 269ffe2
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Google/GTrends.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,21 +333,23 @@ public function explore($keyWordList, $category=0, $time='today 12-m', $property
* @return array|bool
* @throws \Exception
*/
public function interestOverTime($kWord, $category=0, $time='now 1-H', $property='')
public function interestOverTime($kWord, $category=0, $time='now 4-H', $property='')
{
$timeInfo = explode('-', $time);
$timeInfo[0] = strtolower($timeInfo[0]);
$timeUnit = array_pop($timeInfo);
$timeInfo[] = $timeUnit;
$time = implode('-', $timeInfo);

$comparisonItem[] = ['keyword' => $kWord, 'geo' => $this->options['geo'], 'time' => $time];
$payload = [
'hl' => $this->options['hl'],
'tz' => $this->options['tz'],
'req' => Json\Json::encode(['comparisonItem' => $comparisonItem, 'category' => $category, 'property' => $property]),
'req' => Json\Json::encode([
'comparisonItem' => [
[
'keyword' => $kWord,
'geo' => $this->options['geo'],
'time' => $time,
],
],
'category' => $category,
'property' => $property,
]),
];

$data = $this->_getData(self::GENERAL_ENDPOINT, 'GET', $payload);
if ($data) {

Expand Down Expand Up @@ -705,7 +707,6 @@ private function _getData($uri, $method, array $params=[])
unlink($cookieJar);

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

if ($statusCode == 200) {

$headers = $client->getResponse()->getHeaders()->toArray();
Expand Down

0 comments on commit 269ffe2

Please sign in to comment.