public function authenticate()
 {
     /**
      * Array with the OAuth tokens provided by Twitter
      *   - consumer_key        Twitter API key
      *   - consumer_secret     Twitter API secret
      *   - oauth_token         Twitter Access token         * Optional For GET Calls
      *   - oauth_token_secret  Twitter Access token secret  * Optional For GET Calls
      */
     $credentials = array('consumer_key' => 'Lk9hAGCzZ6bKTP3dmI2UHGqyB', 'consumer_secret' => 'dRNmJP5WkHQZ8QmPT3WoM25sAG6SZdwJG5JnyRc5geLE5hY9sx', 'oauth_token' => '2186032518-WknupkqmLuF1dpZyMZSryqW64Ng4brQLR3ucds5', 'oauth_token_secret' => 'YM6a1z4FGCpOgvs4yh3SPUi1AYlEQQ1HW95jLLUlMcOeq');
     /**
      * Instantiate SingleUser
      *
      * For different output formats you can set one of available serializers
      * (Array, Json, Object, Text or a custom one)
      */
     $auth = new SingleUserAuth($credentials, new ArraySerializer());
     /**
      * Returns a collection of the most recent Tweets posted by the user
      * https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
      */
     $params = array('screen_name' => 'Dharmen89390541', 'count' => 3, 'exclude_replies' => true);
     /**
      * Send a GET call with set parameters
      */
     $response = $auth->get('statuses/user_timeline', $params);
     echo '<pre>';
     print_r($auth->getHeaders());
     echo '</pre>';
     echo '<pre>';
     print_r($response);
     echo '</pre><hr />';
 }
Esempio n. 2
0
date_default_timezone_set('UTC');
/**
 * Array with the OAuth tokens provided by Twitter
 *   - consumer_key        Twitter API key
 *   - consumer_secret     Twitter API secret
 *   - oauth_token         Twitter Access token         * Optional For GET Calls
 *   - oauth_token_secret  Twitter Access token secret  * Optional For GET Calls
 */
$credentials = array('consumer_key' => 'xvz1evFS4wEEPTGEFPHBog', 'consumer_secret' => 'L8qq9PZyRg6ieKGEKhZolGC0vJWLw8iEJ88DRdyOg', 'oauth_token' => 'e98c603b55646a6d22249d9b0096e9af29bafcc2', 'oauth_token_secret' => '07cfdf42835998375e71b46d96b4488a5c659c2f');
/**
 * Instantiate SingleUser
 *
 * For different output formats you can set one of available serializers
 * (Array, Json, Object, Text or a custom one)
 */
$auth = new SingleUserAuth($credentials, new ArraySerializer());
/**
 * Returns a collection of the most recent Tweets posted by the user
 * https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
 */
$params = array('screen_name' => 'ricard0per', 'count' => 3, 'exclude_replies' => true);
/**
 * Send a GET call with set parameters
 */
$response = $auth->get('statuses/user_timeline', $params);
echo '<pre>';
print_r($auth->getHeaders());
echo '</pre>';
echo '<pre>';
print_r($response);
echo '</pre><hr />';