當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OAuthRequest::get_parameters方法代碼示例

本文整理匯總了PHP中OAuthRequest::get_parameters方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuthRequest::get_parameters方法的具體用法?PHP OAuthRequest::get_parameters怎麽用?PHP OAuthRequest::get_parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OAuthRequest的用法示例。


在下文中一共展示了OAuthRequest::get_parameters方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: toXML

 /**
  * Serialize the objet to XML
  */
 public function toXML()
 {
     $xml = Parser::convertToDOMDocument("<lti />");
     $this->appendElement($xml, "id", $this->getID());
     $this->appendElement($xml, "instructor", $this->isInstructor());
     foreach ($this->request->get_parameters() as $id => $value) {
         $this->appendElement($xml, $id, $value);
     }
     return $xml;
 }
開發者ID:fresnostate-library,項目名稱:xerxes,代碼行數:13,代碼來源:Basic.php

示例2: testGetAllParameters

 public function testGetAllParameters()
 {
     // Yes, a awesomely boring test.. But if this doesn't work, the other tests is unreliable
     $request = new OAuthRequest('', '', array('test' => 'foo'));
     $this->assertEquals(array('test' => 'foo'), $request->get_parameters(), 'Failed to read back parameters');
     $request = new OAuthRequest('', '', array('test' => 'foo', 'bar' => 'baz'));
     $this->assertEquals(array('test' => 'foo', 'bar' => 'baz'), $request->get_parameters(), 'Failed to read back parameters');
     $request = new OAuthRequest('', '', array('test' => array('foo', 'bar')));
     $this->assertEquals(array('test' => array('foo', 'bar')), $request->get_parameters(), 'Failed to read back parameters');
 }
開發者ID:kawahara,項目名稱:test_mobile_app,代碼行數:10,代碼來源:OAuthRequestTest.php

示例3: _performRequest

 /**
  * Performs a OAuthRequest, returning the response
  * You can give a token to force signatures with this
  * token. If none given, the token used when creating
  * this instance of CampusNotesAPI is used
  * @param OAuthRequest $req
  * @param OAuthToken $token 
  * @return string
  * @throws CNApiException
  */
 private function _performRequest(OAuthRequest $req, OAuthToken $token = null)
 {
     $token = $token ? $token : $this->oauth_token;
     $req->sign_request($this->hmac_signature_method, $this->oauth_consumer, $token);
     $curl = curl_init();
     $params = $req->get_parameters();
     foreach (array_keys($params) as $i) {
         if (substr($i, 0, 6) == 'oauth_') {
             unset($params[$i]);
         }
     }
     $url = $req->get_normalized_http_url();
     if ($req->get_normalized_http_method() == 'POST') {
         curl_setopt($curl, CURLOPT_POST, true);
         curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
     } else {
         if (count($params)) {
             $url .= '?' . http_build_query($params);
         }
     }
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array($req->to_header()));
     $rtn = curl_exec($curl);
     if (!$rtn) {
         throw new OAuthClientException(curl_error($curl));
     } else {
         if (curl_getinfo($curl, CURLINFO_HTTP_CODE) != 200) {
             throw new OAuthClientException($rtn);
         } else {
             return $rtn;
         }
     }
 }
開發者ID:redspider,項目名稱:Entrecredits-API,代碼行數:44,代碼來源:EccOAuth.php


注:本文中的OAuthRequest::get_parameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。