You are here

protected function Twitter::get_search_results in Twitter 7.6

Get an array of TwitterStatus objects matching a specified query.

Parameters

array $params: parameters including the search query.

Return value

array An array of TwitterStatus objects.

See also

https://dev.twitter.com/docs/api/1.1/get/search/tweets

1 call to Twitter::get_search_results()
Twitter::search_tweets in ./twitter.lib.php
Returns a collection of relevant Tweets matching a specified query.

File

./twitter.lib.php, line 274
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

Twitter
Primary Twitter API implementation class

Code

protected function get_search_results($params = array()) {
  $values = $this
    ->call('search/tweets', $params, 'GET');

  // Check on successfull call
  if (isset($values) && isset($values['statuses'])) {
    $statuses = array();
    foreach ($values['statuses'] as $status) {
      $statuses[] = new TwitterStatus($status);
    }
    return $statuses;
  }
  else {

    // As call already throws an exception, we can return an empty array to
    // break no code.
    return array();
  }
}