Horde_Oauth_Request::buildHttpQuery PHP Method

buildHttpQuery() public method

Get a query string suitable for use in a URL or as POST data.
public buildHttpQuery ( )
    public function buildHttpQuery()
    {
        $parts = array();
        foreach ($this->_params as $k => $v) {
            $parts[] = Horde_Oauth_Utils::urlencodeRfc3986($k) . '=' . Horde_Oauth_Utils::urlencodeRfc3986($v);
        }
        return implode('&', $parts);
    }

Usage Example

Esempio n. 1
0
 /**
  * Obtain an access token from a request token
  *
  * @param Horde_Oauth_Token $token Open auth token containing the oauth_token
  *                                 returned from provider after authorization
  *                                 and the token secret returned with the
  *                                 original request token.
  * @param array $params           Any additional parameters for this request
  *
  * @return unknown_type
  */
 public function getAccessToken($token, $params = array())
 {
     $params['oauth_consumer_key'] = $this->key;
     $params['oauth_token'] = $token->key;
     $request = new Horde_Oauth_Request($this->accessTokenUrl, $params);
     $request->sign($this->signatureMethod, $this, $token);
     $client = new Horde_Http_Client();
     try {
         $response = $client->post($this->accessTokenUrl, $request->buildHttpQuery());
     } catch (Horde_Http_Exception $e) {
         throw new Horde_Oauth_Exception($e->getMessage());
     }
     return Horde_Oauth_Token::fromString($response->getBody());
 }