You are here

function TwitterBlockSearch::search in Twitter Block 6

Same name and namespace in other branches
  1. 7 twitter_block.class.php \TwitterBlockSearch::search()

Executes a Twitter Search API call

Return value

string JSON encoded search response.

4 calls to TwitterBlockSearch::search()
TwitterBlockSearch::getMentions in ./twitter_block.class.php
Returns the most recent mentions (status containing @twittername)
TwitterBlockSearch::getReplies in ./twitter_block.class.php
Returns the most recent @replies to $twittername.
TwitterBlockSearch::getTweetsFrom in ./twitter_block.class.php
Returns the most recent tweets from $twittername
TwitterBlockSearch::searchHashtag in ./twitter_block.class.php
Returns the most recent tweets containing a string or hashtag.

File

./twitter_block.class.php, line 173
Lightweight implementation of the Twitter API in PHP.

Class

TwitterBlockSearch
TwitterBlockSearch provides the class for using the Twitter Search API.

Code

function search() {

  // Build a URL query to send to Twitter
  $this->url_query .= drupal_http_build_query($this->options);
  if (variable_get('twitter_block_debug_mode', FALSE)) {
    watchdog('Twitter Block', 'DEBUG: URL: twitter_block_url', array(
      'twitter_block_url' => $this->url_query,
    ), WATCHDOG_NOTICE);
  }

  // Query Twitter
  $twitter_data = drupal_http_request($this->url_query);

  // Set the response status code, or the error code if an error occurred
  $this->http_status = $twitter_data->code;
  if (isset($twitter_data->error)) {
    if (variable_get('twitter_block_debug_mode', FALSE)) {
      watchdog('Twitter Block', 'DEBUG: Returned data: returned_tweet_data', array(
        'returned_tweet_data' => print_r($twitter_data->error, TRUE),
      ), WATCHDOG_NOTICE);
    }
    return;
  }
  return $twitter_data->data;
}