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


PHP HttpRequest::getGet方法代码示例

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


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

示例1: chooseAction

 public function chooseAction(HttpRequest $request)
 {
     $action = Primitive::choice('action')->setList($this->methodMap);
     if ($this->getDefaultAction()) {
         $action->setDefault($this->getDefaultAction());
     }
     Form::create()->add($action)->import($request->getGet())->importMore($request->getPost())->importMore($request->getAttached());
     if (!($command = $action->getValue())) {
         return $action->getDefault();
     }
     return $command;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:12,代码来源:MethodMappedController.class.php

示例2: makeHandle

 protected function makeHandle(HttpRequest $request, CurlHttpResponse $response)
 {
     $handle = curl_init();
     Assert::isNotNull($request->getMethod());
     $options = array(CURLOPT_WRITEFUNCTION => array($response, 'writeBody'), CURLOPT_HEADERFUNCTION => array($response, 'writeHeader'), CURLOPT_URL => $request->getUrl()->toString(), CURLOPT_USERAGENT => 'onPHP::' . __CLASS__);
     if ($this->isPhp55()) {
         $options[CURLOPT_SAFE_UPLOAD] = true;
     }
     if ($this->noBody !== null) {
         $options[CURLOPT_NOBODY] = $this->noBody;
     }
     if ($this->followLocation !== null) {
         $options[CURLOPT_FOLLOWLOCATION] = $this->followLocation;
     }
     switch ($request->getMethod()->getId()) {
         case HttpMethod::GET:
             $options[CURLOPT_HTTPGET] = true;
             if ($request->getGet()) {
                 $options[CURLOPT_URL] .= ($request->getUrl()->getQuery() ? '&' : '?') . $this->argumentsToString($request->getGet());
             }
             break;
         case HttpMethod::POST:
             if ($request->getGet()) {
                 $options[CURLOPT_URL] .= ($request->getUrl()->getQuery() ? '&' : '?') . $this->argumentsToString($request->getGet());
             }
             $options[CURLOPT_POST] = true;
             $options[CURLOPT_POSTFIELDS] = $this->getPostFields($request);
             break;
         default:
             $options[CURLOPT_CUSTOMREQUEST] = $request->getMethod()->getName();
             break;
     }
     $headers = array();
     foreach ($request->getHeaderList() as $headerName => $headerValue) {
         $headers[] = "{$headerName}: {$headerValue}";
     }
     if ($headers) {
         $options[CURLOPT_HTTPHEADER] = $headers;
     }
     if ($request->getCookie()) {
         $cookies = array();
         foreach ($request->getCookie() as $name => $value) {
             $cookies[] = $name . '=' . urlencode($value);
         }
         $options[CURLOPT_COOKIE] = implode('; ', $cookies);
     }
     foreach ($this->options as $key => $value) {
         $options[$key] = $value;
     }
     curl_setopt_array($handle, $options);
     return $handle;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:52,代码来源:CurlHttpClient.class.php

示例3: doContinue

 /**
  * proceed results of checkid_immediate and checkid_setup
  *
  * @param $request incoming request
  * @param
  **/
 public function doContinue(HttpRequest $request, $manager = null)
 {
     if ($manager) {
         Assert::isTrue($manager instanceof OpenIdConsumerAssociationManager);
     }
     $parameters = $this->parseGetParameters($request->getGet());
     foreach ($this->extensions as $extension) {
         $extension->parseResponce($request, $parameters);
     }
     if (!isset($parameters['openid.mode'])) {
         throw new WrongArgumentException('not an openid request');
     }
     if ($parameters['openid.mode'] == 'id_res') {
         if (isset($parameters['openid.user_setup_url'])) {
             $setupUrl = HttpUrl::create()->parse($parameters['openid.user_setup_url']);
             Assert::isTrue($setupUrl->isValid());
             return new OpenIdConsumerSetupRequired($setupUrl);
         }
     } elseif ($parameters['openid.mode'] = 'cancel') {
         return new OpenIdConsumerCancel();
     }
     if (!isset($parameters['openid.assoc_handle'])) {
         throw new WrongArgumentException('no association handle');
     }
     if (!isset($parameters['openid.identity'])) {
         throw new WrongArgumentException('no identity');
     }
     $identity = HttpUrl::create()->parse($parameters['openid.identity']);
     Assert::isTrue($identity->isValid(), 'invalid identity');
     $identity->makeComparable();
     $signedFields = array();
     if (isset($parameters['openid.signed'], $parameters['openid.sig'])) {
         $signedFields = explode(',', $parameters['openid.signed']);
         if (!in_array('identity', $signedFields)) {
             throw new WrongArgumentException('identity must be signed');
         }
     } else {
         throw new WrongArgumentException('no signature in response');
     }
     if ($manager && ($association = $manager->findByHandle($parameters['openid.assoc_handle'], self::ASSOCIATION_TYPE)) && !isset($parameters['openid.invalidate_handle'])) {
         // smart mode
         $tokenContents = null;
         foreach ($signedFields as $signedField) {
             $tokenContents .= $signedField . ':' . $parameters['openid.' . strtr($signedField, '.', '_')] . "\n";
         }
         if (base64_encode(CryptoFunctions::hmacsha1($association->getSecret(), $tokenContents)) != $parameters['openid.sig']) {
             throw new WrongArgumentException('signature mismatch');
         }
         return new OpenIdConsumerPositive($identity);
     } elseif (!$manager || isset($parameters['openid.invalidate_handle'])) {
         // dumb or handle invalidation mode
         if ($this->checkAuthentication($parameters, $manager)) {
             return new OpenIdConsumerPositive($identity);
         } else {
             return new OpenIdConsumerFail();
         }
     }
     Assert::isUnreachable();
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:65,代码来源:OpenIdConsumer.class.php


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