本文整理汇总了PHP中OAuthRequest::generate_nonce方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuthRequest::generate_nonce方法的具体用法?PHP OAuthRequest::generate_nonce怎么用?PHP OAuthRequest::generate_nonce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuthRequest
的用法示例。
在下文中一共展示了OAuthRequest::generate_nonce方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL)
{
$parameters = $parameters ? $parameters : array();
$defaults = array("oauth_version" => OAuthRequest::$version, "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
if ($token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
return new OAuthRequest($http_method, $http_url, $parameters);
}
示例2: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL)
{
@$parameters or $parameters = array();
$defaults = array("oauth_version" => OAuthRequest::$version, "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
if ($token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
// Parse the query-string to find and add GET parameters
$parts = parse_url($http_url);
if (isset($parts['query'])) {
$qparms = OAuthUtil::parse_parameters($parts['query']);
$parameters = array_merge($qparms, $parameters);
}
return new OAuthRequest($http_method, $http_url, $parameters);
}
示例3: array
/**
* pretty much a helper function to set up the request
* @access public
*/
function &from_consumer_and_token(&$consumer, $token, $http_method, $http_url, $parameters = NULL)
{
//$OAuthRequest = new OAuthRequest($http_method, $http_url);
@$parameters or $parameters = array();
$defaults = array("oauth_version" => '1.0', "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
if ($token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
$OAuthRequest = new OAuthRequest($http_method, $http_url, $parameters);
return $OAuthRequest;
}
示例4: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = array())
{
/*{{{*/
static $version = '1.0';
$defaults = array("oauth_version" => $version, "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
$parameters = array_merge($defaults, $parameters);
if ($token) {
$parameters['oauth_token'] = $token->key;
}
$req = new OAuthRequest($http_method, $http_url, $parameters);
return $req;
}
示例5: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL)
{
/*{{{*/
@$parameters or $parameters = array();
$defaults = array("oauth_version" => OAuthRequest::$version, "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
$parameters = array_merge($defaults, $parameters);
if ($token) {
$parameters['oauth_token'] = $token->key;
}
// oauth v1.0a
/*if (isset($_REQUEST['oauth_verifier'])) {
$parameters['oauth_verifier'] = $_REQUEST['oauth_verifier'];
}*/
return new OAuthRequest($http_method, $http_url, $parameters);
}
示例6: addOAuthParams
private function addOAuthParams(&$msgParams)
{
$msgParams[OAuth::$OAUTH_TOKEN] = '';
$domain = $this->authToken->getDomain();
if ($domain != null) {
$msgParams[OAuth::$OAUTH_CONSUMER_KEY] = $domain;
}
if ($this->keyName != null) {
$msgParams[SigningFetcher::$XOAUTH_PUBLIC_KEY] = $this->keyName;
}
$nonce = OAuthRequest::generate_nonce();
$msgParams[OAuth::$OAUTH_NONCE] = $nonce;
$timestamp = time();
$msgParams[OAuth::$OAUTH_TIMESTAMP] = $timestamp;
$msgParams[OAuth::$OAUTH_SIGNATURE_METHOD] = OAuth::$RSA_SHA1;
}
示例7: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
public static function from_consumer_and_token ($consumer, $token, $http_method, $http_url, $parameters=null) {
if (is_null ($parameters)) {
$parameters = array();
}
$defaults = array (
'oauth_version' => OAuthRequest::$version,
'oauth_nonce' => OAuthRequest::generate_nonce (),
'oauth_timestamp' => OAuthRequest::generate_timestamp (),
'oauth_consumer_key' => $consumer->key
);
if ($token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge ($defaults, $parameters);
return new OAuthRequest ($http_method, $http_url, $parameters);
}
示例8: request
function request($url, $extra = array(), $force_post = false)
{
$oauth = array('oauth_version' => OAuthRequest::$version, 'oauth_nonce' => OAuthRequest::generate_nonce(), 'oauth_timestamp' => OAuthRequest::generate_timestamp(), 'oauth_consumer_key' => $this->consumer->key, 'oauth_token' => $this->access_token->key, 'oauth_signature_method' => $this->oa_method->get_name());
if (isset($extra['post'])) {
$params = $extra['post'];
} elseif (isset($extra['get'])) {
$params = $extra['get'];
} else {
$params = array();
}
if (isset($extra['post']) || $force_post) {
$method = 'POST';
} else {
$method = 'GET';
}
$params = array_merge($params, $oauth);
$request = new OAuthRequest($method, $url, $params);
$params['oauth_signature'] = $request->build_signature($this->oa_method, $this->consumer, $this->access_token);
$extra[strtolower($method)] = $params;
return parent::request($url, $extra, $force_post);
}
示例9: from_consumer_and_token
/**
* pretty much a helper function to set up the request
*/
function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL)
{
@$parameters or $parameters = array();
$defaults = array("source" => $consumer->key, "oauth_version" => $GLOBALS['__CLASS']['OAuthRequest']['__STATIC']['OAuthRequest_version'], "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), "oauth_consumer_key" => $consumer->key);
if ($token) {
$defaults['oauth_token'] = $token->key;
}
$parameters = array_merge($defaults, $parameters);
return new OAuthRequest($http_method, $http_url, $parameters);
}
示例10: __build_oauth_header
private function __build_oauth_header($linkedin_url)
{
$request = new OAuthRequest('GET', $linkedin_url, array('oauth_nonce' => OAuthRequest::generate_nonce(), 'oauth_timestamp' => OAuthRequest::generate_timestamp(), 'oauth_version' => '1.0', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_consumer_key' => $this->oaConsumerKey, 'oauth_token' => OAUTH_USER_TOKEN));
$request->sign_request($this->signature, new OAuthConsumer('', $this->oaConsumerSecret), new OAuthToken('', '95b27494-0a99-47c0-a66c-533cef4b8a28'));
return $request->to_header();
}