Implemented pagetoken and dropped unsetting
Thanks to @bristweb for this update! Seems I failed to properly implement the pagetoken and there was a block of code where I was unsetting parameters because at the time it seemed as if Google was not ignoring them as they claimed they would (a/k/a they "lied"). I'm not overly fond of the `sleep(3)` but it's a necessary evil because Google's pagetokens are not immediately available (as per https://developers.google.com/places/documentation/search#PlaceSearchPaging). My thought would be to perhaps create a loop that will retry X times every Y seconds to better compensate for inconsistent activation times on Google's end. Closes #4 (for the most part)
This commit is contained in:
parent
5ebede0e03
commit
f2eddb8036
1 changed files with 6 additions and 6 deletions
|
@ -44,12 +44,6 @@ class GooglePlaces
|
||||||
// Except these variables
|
// Except these variables
|
||||||
if (!in_array($variable, array('base_url', 'method', 'output', 'pagetoken', 'response')))
|
if (!in_array($variable, array('base_url', 'method', 'output', 'pagetoken', 'response')))
|
||||||
{
|
{
|
||||||
// Google lied, all other parameters aren't ignored, they need to be suppressed
|
|
||||||
if ($this->pagetoken !== null)
|
|
||||||
{
|
|
||||||
$this->$variable == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assuming it's not null
|
// Assuming it's not null
|
||||||
if ($value !== null)
|
if ($value !== null)
|
||||||
{
|
{
|
||||||
|
@ -179,6 +173,12 @@ class GooglePlaces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->pagetoken !== null)
|
||||||
|
{
|
||||||
|
$parameters['pagetoken'] = $this->pagetoken;
|
||||||
|
sleep(3);
|
||||||
|
}
|
||||||
|
|
||||||
// Couldn't seem to get http_build_query() to work right so...
|
// Couldn't seem to get http_build_query() to work right so...
|
||||||
$querystring = '';
|
$querystring = '';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue