You are here

protected function Twitter::parse_response in Twitter 7.3

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \Twitter::parse_response()
  2. 6.3 twitter.lib.php \Twitter::parse_response()
  3. 7.6 twitter.lib.php \Twitter::parse_response()
  4. 7.5 twitter.lib.php \Twitter::parse_response()
2 calls to Twitter::parse_response()
Twitter::call in ./twitter.lib.php
Calls a twitter api resource
Twitter::request in ./twitter.lib.php
Perform a request

File

./twitter.lib.php, line 251
Classes to implement the full Twitter API

Class

Twitter
Primary Twitter API implementation class Supports the full REST API for twitter.

Code

protected function parse_response($response, $format = NULL) {
  if (empty($format)) {
    $format = $this->format;
  }
  switch ($format) {
    case 'json':

      // http://drupal.org/node/985544 - json_decode large integer issue
      $length = strlen(PHP_INT_MAX);
      $response = preg_replace('/"(id|in_reply_to_status_id)":(\\d{' . $length . ',})/', '"\\1":"\\2"', $response);
      return json_decode($response, TRUE);
  }
}