TwitterOAuth::get PHP Method

get() public method

GET wrapper for oAuthRequest.
public get ( $url, $parameters = [] )
    function get($url, $parameters = array())
    {
        $response = $this->oAuthRequest($url, 'GET', $parameters);
        if ($this->format === 'json' && $this->decode_json) {
            return json_decode($response);
        }
        return $response;
    }

Usage Example

Esempio n. 1
0
 public function test()
 {
     $aModel = TuiyoLoader::model("applications", true);
     $aUser = TuiyoAPI::get("user", null);
     $aDocument = TuiyoAPI::get("document", null);
     $aParams = $aModel->getSingleUserPlugin($aUser->id, "twitter");
     if (!is_object($aParams)) {
         $aDocument->enqueMessage(_("Cannot Load the service for this user"), "error");
         return false;
     }
     echo $aParams->get("oauth_verifier");
     /* Build TwitterOAuth object with client credentials. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
     $view =& $this->getView("twitter", "html");
     /* Get temporary credentials. */
     $access_token = $connection->getAccessToken($aParams->get('oauth_verifier', false));
     /* Create a TwitterOauth object with consumer/user tokens. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
     /* If method is set change API call made. Test is called by default. */
     $content = $connection->get('account/verify_credentials');
     //print_R($content);
     $user = $connection->get('account/verify_credentials');
     $userPublicFeeds = $connection->get('statuses/public_timeline');
     print_R($userPublicFeeds);
 }
All Usage Examples Of TwitterOAuth::get