本文整理汇总了PHP中OAuth::setSSLChecks方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuth::setSSLChecks方法的具体用法?PHP OAuth::setSSLChecks怎么用?PHP OAuth::setSSLChecks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuth
的用法示例。
在下文中一共展示了OAuth::setSSLChecks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetClient
/**
* Constructs a new OAuth client object.
* @param array $credentials the credentials to use
* @param string $authorizationType the authorization type to use
* @return OAuth a new OAuth client
*/
private function GetClient($credentials, $authorizationType = NULL)
{
$client = new OAuth($credentials['oauth_consumer_key'], $credentials['oauth_consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, $authorizationType);
$client->setRequestEngine(OAUTH_REQENGINE_CURL);
$client->setVersion('1.0a');
if (isset($credentials['oauth_token']) && isset($credentials['oauth_token_secret'])) {
$client->setToken($credentials['oauth_token'], $credentials['oauth_token_secret']);
}
// SSL settings.
if (defined('SSL_VERIFY_PEER') && SSL_VERIFY_PEER) {
$client->setSSLChecks(OAUTH_SSLCHECK_PEER);
} else {
$client->setSSLChecks(OAUTH_SSLCHECK_NONE);
}
if (defined('SSL_VERIFY_HOST') && SSL_VERIFY_HOST) {
if ($client->sslChecks == OAUTH_SSLCHECK_PEER) {
$client->setSSLChecks(OAUTH_SSLCHECK_BOTH);
} else {
$client->setSSLChecks(OAUTH_SSLCHECK_HOST);
}
}
if (defined('SSL_CA_PATH') && SSL_CA_PATH != '') {
// The second parameter must be explicitly set to NULL due to a bug in
// version 1.2.2 and earlier. See https://bugs.php.net/bug.php?id=60226
$client->setCAPath(SSL_CA_PATH, NULL);
}
if (defined('SSL_CA_FILE') && SSL_CA_FILE != '') {
$client->setCAPath(NULL, SSL_CA_FILE);
}
return $client;
}