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


PHP Request::head方法代码示例

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


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

示例1: processAction

 public function processAction(CRM_Civirules_TriggerData_TriggerData $triggerData)
 {
     //do the http post process
     $uri = $this->getFullUri($triggerData);
     $method = $this->getHttpMethod();
     $body = http_build_query($this->getBodyParams($triggerData));
     switch (strtolower($method)) {
         case 'post':
             $request = \Httpful\Request::post($uri, $body);
             break;
         case 'put':
             $request = \Httpful\Request::put($uri, $body);
             break;
         case 'delete':
             $request = \Httpful\Request::delete($uri);
             break;
         case 'head':
             $request = \Httpful\Request::head($uri);
             break;
         case 'patch':
             $request = \Httpful\Request::patch($uri, $body);
             break;
         case 'options':
             $request = \Httpful\Request::options($uri, $body);
             break;
         case 'get':
             $request = $response = \Httpful\Request::get($uri);
             break;
         default:
             throw new Exception('Invalid HTTP Method');
     }
     $request->neverSerializePayload();
     $request = $this->alterHttpRequestObject($request, $triggerData);
     $response = $request->send();
     $this->handleResponse($response, $request, $triggerData);
 }
开发者ID:CiviCooP,项目名称:org.civicoop.civiruleshttppost,代码行数:36,代码来源:HttpPostAction.php

示例2: getHttpStatusCode

 /**
  * Get http status code of url
  * @param string $url url to check
  * @return integer http status
  */
 public function getHttpStatusCode($url)
 {
     $response = PHPHttpful::head($url)->send();
     return $response->code;
 }
开发者ID:msankhala,项目名称:parsehub-php,代码行数:10,代码来源:Parsehub.php

示例3: invoke

 private function invoke($action, $uri, $headers, $method, $expects, $payload)
 {
     if ($this->fds_config->isMetricsEnabled()) {
         $request_metrics = new RequestMetrics($action);
         $request_metrics->startEvent(RequestMetrics::EXECUTION_TIME);
     }
     $request = null;
     switch ($method) {
         case Http::GET:
             $request = Request::get($uri);
             break;
         case Http::PUT:
             $request = Request::put($uri, $payload);
             break;
         case Http::POST:
             $request = Request::post($uri, $payload);
             break;
         case Http::DELETE:
             $request = Request::delete($uri);
             break;
         case Http::HEAD:
             $request = Request::head($uri);
     }
     if ($expects != null) {
         $request = $request->expects($expects);
     }
     $response = $request->addHeaders($headers)->retry($this->fds_config->getRetry())->timeout($this->fds_config->getConnectionTimeoutSecs())->send();
     if ($this->fds_config->isMetricsEnabled()) {
         $request_metrics->endEvent(RequestMetrics::EXECUTION_TIME);
         $this->metrics_collector->collect($request_metrics);
     }
     return $response;
 }
开发者ID:xiaomi,项目名称:galaxy-fds-sdk-php,代码行数:33,代码来源:GalaxyFDSClient.php


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