本文整理匯總了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;
}