geoSearch() public method

Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the ID of this location with a call to POST statuses/update. This is the recommended method to use find places that can be attached to statuses/update. Unlike GET geo/reverse_geocode which provides raw data access, this endpoint can potentially re-order places with regards to the user who is authenticated. This approach is also preferred for interactive place matching with the user.
public geoSearch ( float[optional] $lat = null, float[optional] $long = null, string[optional] $query = null, string[optional] $ip = null, string[optional] $granularity = null, string[optional] $accuracy = null, int[optional] $maxResults = null, string[optional] $containedWithin = null, array $attributes = null ) : array
$lat float[optional]
$long float[optional]
$query string[optional]
$ip string[optional]
$granularity string[optional]
$accuracy string[optional]
$maxResults int[optional]
$containedWithin string[optional]
$attributes array
return array
Ejemplo n.º 1
0
 /**
  * Tests Twitter->geoSearch()
  */
 public function testGeoSearch()
 {
     $response = $this->twitter->geoSearch(37.7821120598956, -122.400612831116);
     $this->assertArrayHasKey('result', $response);
     $this->assertArrayHasKey('places', $response['result']);
     foreach ($response['result']['places'] as $row) {
         $this->isPlace($row);
     }
     $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('granularity', $response['query']['params']);
     $this->assertArrayHasKey('query', $response['query']['params']);
     $this->assertArrayHasKey('url', $response['query']);
 }