You are here

public function Twitter::getParsedResponse in Twitter 7.6

Same name and namespace in other branches
  1. 7.5 twitter.lib.php \Twitter::getParsedResponse()

Retrieves the parsed response of the Twitter API endpoint call.

Parameters

string $path: The location of the endpoint.

array $params: Any parameters the endpoint needs to complete the call.

string $method: The REST method to use when making the call.

bool $extended: If set to TRUE, retrieves the extended mode version of the tweet. If set to FALSE, retrieves the compatibility mode version of the tweet.

Return value

array The decoded JSON reply.

1 call to Twitter::getParsedResponse()
Twitter::call in ./twitter.lib.php
Calls a Twitter API endpoint.

File

./twitter.lib.php, line 1354
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

public function getParsedResponse($path, array $params = array(), $method = 'GET', $extended = FALSE) {
  if ($extended) {
    $url = $this
      ->create_url($path, '.json', TRUE);
  }
  else {
    $url = $this
      ->create_url($path);
  }
  try {
    $response = $this
      ->auth_request($url, $params, $method);
  } catch (TwitterException $e) {
    watchdog('twitter', '!message', array(
      '!message' => $e
        ->__toString(),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  if (!$response) {
    return FALSE;
  }
  return $this
    ->parse_response($response);
}