You are here

public function Twitter::call in Twitter 6.3

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \Twitter::call()
  2. 7.6 twitter.lib.php \Twitter::call()
  3. 7.3 twitter.lib.php \Twitter::call()
  4. 7.5 twitter.lib.php \Twitter::call()

Calls a twitter api resource

Parameters

$path: string REST resource to be called

$params: array of settings to be sent along

$method: string method to be used (GET or POST)

$use_oauth: boolean indicating if the call should use OAuth authentication of not

4 calls to Twitter::call()
Twitter::get_statuses in ./twitter.lib.php
Get an array of TwitterStatus objects from an API endpoint
Twitter::status_update in ./twitter.lib.php
Post a new status.
Twitter::users_show in ./twitter.lib.php
Returns profile information about a user.
Twitter::verify_credentials in ./twitter.lib.php

File

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

Class

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

Code

public function call($path, $params = array(), $method = 'GET', $use_auth = FALSE) {
  $url = $this
    ->create_url($path);
  try {
    if ($use_auth) {
      $response = $this
        ->auth_request($url, $params, $method);
    }
    else {
      $response = $this
        ->request($url, $params, $method);
    }
  } catch (TwitterException $e) {
    watchdog('twitter', '!message', array(
      '!message' => $e
        ->__toString(),
    ), WATCHDOG_ERROR);
    drupal_set_message('Twitter returned an error: ' . $e
      ->getMessage(), 'error');
    return FALSE;
  }
  if (!$response) {
    return FALSE;
  }
  return $this
    ->parse_response($response);
}