本文整理匯總了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;
}