本文整理汇总了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);
}
示例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;
}
示例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;
}