當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。