本文整理汇总了PHP中Zend_Oauth::setHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Oauth::setHttpClient方法的具体用法?PHP Zend_Oauth::setHttpClient怎么用?PHP Zend_Oauth::setHttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Oauth
的用法示例。
在下文中一共展示了Zend_Oauth::setHttpClient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
public function setup()
{
$this->stubConsumer = new Test_Consumer_32874();
$this->stubConsumer2 = new Test_Consumer_32874b();
$this->stubHttpUtility = new Test_Http_Utility_32874();
Zend_Oauth::setHttpClient(new Test_Client_32874());
}
示例2: testGetHttpClientResetsAuthorizationHeader
public function testGetHttpClientResetsAuthorizationHeader()
{
$client = new Test_Http_Client_19485876();
$client->setHeaders('Authorization', 'realm="http://www.example.com",oauth_version="1.0"');
Zend_Oauth::setHttpClient($client);
$resetClient = Zend_Oauth::getHttpClient();
$this->assertEquals(null, $resetClient->getHeader('Authorization'));
}
示例3: getService
/**
* Gets the Twitter service object for a token
*
* @param string|Zend_Oauth_Token_Access $token Access token object or access token string
* @param null|string $secret Access token secret if token is provided as string
*
* @return Zend_Service_Twitter
*/
public static function getService($token, $secret = null)
{
$options = XenForo_Application::getOptions();
Zend_Oauth::setHttpClient(XenForo_Helper_Http::getClient('https://api.twitter.com/oauth'));
if ($token instanceof Zend_Oauth_Token_Access) {
$accessToken = $token;
} else {
$accessToken = new Zend_Oauth_Token_Access();
$accessToken->setToken($token);
$accessToken->setTokenSecret($secret);
}
return new Zend_Service_Twitter(array('accessToken' => $accessToken, 'oauthOptions' => array('consumerKey' => trim($options->twitterAppKey), 'consumerSecret' => trim($options->twitterAppSecret)), 'httpClientOptions' => XenForo_Helper_Http::getExtraHttpClientOptions('https://api.twitter.com/oauth')));
}