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


PHP RequestInterface::addPostFields方法代码示例

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


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

示例1: visit

 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $this->fqname = $command->getName();
     $query = array();
     $this->customResolver($value, $param, $query, $param->getWireName());
     $request->addPostFields($query);
 }
开发者ID:loulancn,项目名称:core,代码行数:7,代码来源:AwsQueryVisitor.php

示例2: setBody

 public static function setBody(RequestInterface $request, $body, $options)
 {
     $type = isset($options['request_type']) ? $options['request_type'] : 'form';
     $header = null;
     if ($type == 'form') {
         // Encoding body into form-urlencoded format
         return $request->addPostFields($body);
     }
     if ($type == 'raw') {
         // Raw body
         return $request->setBody($body, $header);
     }
 }
开发者ID:apetrova0912,项目名称:buffer-php,代码行数:13,代码来源:RequestHandler.php

示例3: onRequest

 protected function onRequest(ConnectionInterface $from, RequestInterface $request)
 {
     $requestPath = $request->getPath();
     $body = (string) $request->getBody();
     if (!empty($body)) {
         $query = QueryString::fromString($body);
         $fields = $query->getAll();
         $request->addPostFields($fields);
     }
     // TODO: use only $req->acceptLanguage() in Managers
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = (string) $request->getHeaders()->get('accept-language');
     $routes = array('/' => 'executeUiBooter', '/api' => 'executeApiCall', '/api/group' => 'executeApiCallGroup', '/sbin/apicall.php' => 'executeApiCall', '/sbin/apicallgroup.php' => 'executeApiCallGroup', '/sbin/rawdatacall.php' => 'executeRawDataCall', '#^/([a-zA-Z0-9-_.]+)\\.html$#' => 'executeUiBooter', '#^/(bin|boot|etc|home|tmp|usr|var)/(.*)$#' => 'executeReadFile', '/webos.webapp' => 'executeReadManifest', '/hello' => 'executeSayHello');
     foreach ($routes as $path => $method) {
         $matched = false;
         if (substr($path, 0, 1) == '#') {
             // Regex
             if (preg_match($path, $requestPath, $matches)) {
                 $result = $this->{$method}($from, $request, $matches);
                 $matched = true;
             }
         } else {
             if ($path == $requestPath) {
                 $result = $this->{$method}($from, $request);
                 $matched = true;
             }
         }
         if ($matched) {
             if (empty($result)) {
                 $result = '';
             }
             if ($result instanceof ResponseContent) {
                 $result = $result->generate();
             }
             if ($result instanceof HTTPServerResponse) {
                 if ($result->headersSent()) {
                     // Implicit mode, content already sent
                     if ($result->getHeader('Connection') != 'keep-alive') {
                         $from->close();
                     }
                 } else {
                     $result->send();
                 }
                 return;
             }
             $response = null;
             if (is_string($result)) {
                 $response = new Response(200, array(), (string) $result);
             } else {
                 $response = $result;
             }
             $from->send((string) $response);
             $from->close();
             return;
         }
     }
     $resp = new Response(404, array('Content-Type' => 'text/plain'), '404 Not Found');
     $from->send((string) $resp);
     $from->close();
 }
开发者ID:Rudi9719,项目名称:stein-syn,代码行数:59,代码来源:HttpServer.class.php

示例4: configureRequest

 private function configureRequest(RequestInterface $request, array $server, array $enclosure)
 {
     if (isset($server['HTTP_HOST'])) {
         $request->setHost($server['HTTP_HOST']);
     }
     if (isset($server['HTTP_PORT'])) {
         $request->setPort($server['HTTP_PORT']);
     }
     if (isset($server['PHP_AUTH_USER'])) {
         $request->setAuth($server['PHP_AUTH_USER'], isset($server['PHP_AUTH_PW']) ? $server['PHP_AUTH_PW'] : null);
     }
     $params = [];
     if (isset($server['HTTP_USER_AGENT'])) {
         $params['userAgent'] = $server['HTTP_USER_AGENT'];
     }
     if ($request instanceof EntityEnclosingRequestInterface) {
         $request->addPostFields($enclosure);
     }
     return $params;
 }
开发者ID:internations,项目名称:http-mock,代码行数:20,代码来源:RequestCollectionFacade.php


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