Conceptually you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to POST geo/place to create a new one.
The token contained in the response is the token needed to be able to create a new place.
public geoSimilarPlaces ( float $lat, float $long, string $name, string[optional] $containedWithin = null, array $attributes = null ) : array | ||
$lat | float | The latitude to search around. This parameter will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding long parameter. |
$long | float | The longitude to search around. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This parameter will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding lat parameter. |
$name | string | The name a place is known as. |
$containedWithin | string[optional] | |
$attributes | array | |
return | array |
/** * Tests Twitter->geoSimilarPlaces() */ public function testGeoSimilarPlaces() { $response = $this->twitter->geoSimilarPlaces(37.7821120598956, -122.400612831116, 'Twitter HQ'); $this->assertArrayHasKey('result', $response); $this->assertArrayHasKey('places', $response['result']); foreach ($response['result']['places'] as $row) { $this->isPlace($row); } $this->assertArrayHasKey('token', $response['result']); $this->assertArrayHasKey('query', $response); $this->assertArrayHasKey('type', $response['query']); $this->assertArrayHasKey('params', $response['query']); $this->assertArrayHasKey('coordinates', $response['query']['params']); $this->assertArrayHasKey('autocomplete', $response['query']['params']); $this->assertArrayHasKey('accuracy', $response['query']['params']); $this->assertArrayHasKey('name', $response['query']['params']); $this->assertArrayHasKey('contained_within', $response['query']['params']); $this->assertArrayHasKey('granularity', $response['query']['params']); $this->assertArrayHasKey('query', $response['query']['params']); $this->assertArrayHasKey('strict', $response['query']['params']); $this->assertArrayHasKey('url', $response['query']); }