当前位置: 首页>>代码示例>>PHP>>正文


PHP OAuthUtil::urldecodeRFC3986方法代码示例

本文整理汇总了PHP中OAuthUtil::urldecodeRFC3986方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuthUtil::urldecodeRFC3986方法的具体用法?PHP OAuthUtil::urldecodeRFC3986怎么用?PHP OAuthUtil::urldecodeRFC3986使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OAuthUtil的用法示例。


在下文中一共展示了OAuthUtil::urldecodeRFC3986方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: decodeHeaderEncodedArray

	public static function decodeHeaderEncodedArray($headerValue){
		$valuesArr = array();
		$pairs = array();
		$name = '';
		$value = '';
		 
		if(is_string($headerValue)){
			$valuesArr = explode(',',$headerValue);

			foreach($valuesArr as $pair){
				if(strpos($pair,'=')){
					//this param has a key value pair
					$pair = trim($pair);
					list($name, $value) = explode('=', $param, 2);
				}else{
					//this is an empty param and only has a name
					$name = $pair;
					$value = '';
				}
					
				//lets push it to the array if it has a name
				if(!empty($name)){

					//we may need to validate the $name, not all returnable chars may be valid
					$name = OAuthUtil::urldecodeRFC3986($name);
					$value = OAuthUtil::urldecodeRFC3986($value);

					//we should be able to set value to an empty string ''
					$pairs[$name] = $value;
				}
			}//end foreach

			return $pairs;//returns array
		}
		 
		return null;//was unable to parse
	}
开发者ID:hoalangoc,项目名称:ftf,代码行数:37,代码来源:OAuth.php

示例2: decodeForm

 public static function decodeForm($form)
 {
     $parameters = array();
     $explodedForm = explode("&", $form);
     foreach ($explodedForm as $params) {
         $value = explode("=", $params);
         if (!empty($value[0]) && !empty($value[1])) {
             $parameters[OAuthUtil::urldecodeRFC3986($value[0])] = OAuthUtil::urldecodeRFC3986($value[1]);
         }
     }
     return $parameters;
 }
开发者ID:unpush,项目名称:apache-incubator-shindig,代码行数:12,代码来源:OAuth.php

示例3: obtainRequestToken

 /**
  * Obtains a request token from the specified provider.
  *
  * @param apiCache $cache cache class to use (file,apc,memcache,mysql)
  */
 public function obtainRequestToken($callbackUrl, $uid)
 {
     $callbackParams = (strpos($_SERVER['REQUEST_URI'], '?') !== false ? '&' : '?') . 'uid=' . urlencode($uid);
     $ret = $this->requestRequestToken($callbackUrl . $callbackParams);
     $matches = array();
     preg_match('/oauth_token=(.*)&oauth_token_secret=(.*)&oauth_callback_confirmed=(.*)/', $ret, $matches);
     if (!is_array($matches) || count($matches) != 4) {
         throw new apiAuthException("Error retrieving request key ({$ret})");
     }
     return new OAuthToken(OAuthUtil::urldecodeRFC3986($matches[1]), OAuthUtil::urldecodeRFC3986($matches[2]));
 }
开发者ID:wty717,项目名称:heka-interactive-google-buzz-app,代码行数:16,代码来源:apiOAuth.php

示例4: fetchData

 /**
  * Get honest-to-goodness user data.
  */
 private function fetchData()
 {
     try {
         $msgParams = OAuthUtil::isFormEncoded($this->realRequest->getContentType()) ? OAuthUtil::urldecodeRFC3986($this->realRequest->getPostBody()) : array();
         $method = $this->realRequest->getMethod();
         $msgParams[self::$XOAUTH_APP_URL] = $this->authToken->getAppUrl();
         // Build and sign the message.
         $oauthRequest = $this->newRequestMessageMethod($method, $this->realRequest->getUrl(), $msgParams);
         $rcr = $this->createRemoteContentRequest($this->filterOAuthParams($oauthRequest), $this->realRequest->getMethod(), $this->realRequest->getUrl(), $this->realRequest->getHeaders(), $this->realRequest->getContentType(), $this->realRequest->getPostBody(), $this->realRequest->getOptions());
         $content = $this->getNextFetcher()->fetchRequest($rcr);
         //TODO is there a better way to detect an SP error?
         $statusCode = $content->getHttpCode();
         if ($statusCode >= 400 && $statusCode < 500) {
             $message = $this->parseAuthHeader(null, $content);
             if ($message->get_parameter(OAuth::$OAUTH_PROBLEM) != null) {
                 throw new OAuthProtocolException($message);
             }
         }
         // Track metadata on the response
         $this->addResponseMetadata();
         return $content;
     } catch (Exception $e) {
         throw new GadgetException("INTERNAL SERVER ERROR: " . $e);
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:28,代码来源:OAuthFetcher.php


注:本文中的OAuthUtil::urldecodeRFC3986方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。