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