TwitterOAuth::oAuthRequest PHP Method

oAuthRequest() public method

Format and sign an OAuth / API request
public oAuthRequest ( $url, $method, $parameters )
    function oAuthRequest($url, $method, $parameters)
    {
        if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
            $url = "{$this->host}{$url}.{$this->format}";
        }
        $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
        $request->sign_request($this->sha1_method, $this->consumer, $this->token);
        switch ($method) {
            case 'GET':
                return $this->http($request->to_url(), 'GET');
            default:
                return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
        }
    }

Usage Example

 function testIDsList()
 {
     global $THINKTANK_CFG;
     $to = new TwitterOAuth('', '', '', '');
     $result = $to->oAuthRequest('https://twitter.com/followers/ids.xml', array(), 'GET');
     $r = array();
     $r["id"] = 0;
     $r['network_username'] = '******';
     $r['network_user_id'] = 0;
     $r['last_status_id'] = 0;
     $r['last_page_fetched_replies'] = 0;
     $r['last_page_fetched_tweets'] = 0;
     $r['total_posts_in_system'] = 0;
     $r['total_replies_in_system'] = 0;
     $r['total_follows_in_system'] = 0;
     $r['total_users_in_system'] = 0;
     $r['is_archive_loaded_replies'] = 0;
     $r['is_archive_loaded_follows'] = 0;
     $r['crawler_last_run'] = '1/1/2007';
     $r['earliest_reply_in_system'] = 0;
     $r['api_calls_to_leave_unmade_per_minute'] = 5;
     $r['avg_replies_per_day'] = 0;
     $r['is_public'] = 1;
     $r['is_active'] = 1;
     $r['network'] = 'twitter';
     $i = new Instance($r);
     $api = new CrawlerTwitterAPIAccessorOAuth('111', '222', $THINKTANK_CFG['oauth_consumer_key'], $THINKTANK_CFG['oauth_consumer_secret'], $i, $THINKTANK_CFG['archive_limit']);
     $users = $api->parseXML($result);
     $next_cursor = $api->getNextCursor();
     //echo 'Next cursor is ' . $next_cursor;
     $this->assertTrue($next_cursor == '1326272872342936860');
 }
All Usage Examples Of TwitterOAuth::oAuthRequest