本文整理匯總了PHP中Handler::responseHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Handler::responseHeader方法的具體用法?PHP Handler::responseHeader怎麽用?PHP Handler::responseHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Handler
的用法示例。
在下文中一共展示了Handler::responseHeader方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setResponseHeader
public static function setResponseHeader($resource)
{
Handler::$responseHeader = 'Não definido';
if ($resource instanceof SoapClient) {
Handler::$responseHeader = $resource->__getLastResponseHeaders();
}
return true;
}
示例2: execute
public static function execute($data, $service, $key, $token, $enabledPost = true)
{
$resource = curl_init($service);
$vtex_params_proxy = Config::get('vtex_params_proxy');
$vtex_params_proxy = Config::get('development') === true ? $vtex_params_proxy['development'] : $vtex_params_proxy['production'];
if ($enabledPost === true) {
curl_setopt($resource, CURLOPT_POST, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($resource, CURLOPT_HEADER, true);
curl_setopt($resource, CURLOPT_PROXY, $vtex_params_proxy['proxy_host']);
curl_setopt($resource, CURLOPT_PROXYPORT, $vtex_params_proxy['proxy_port']);
curl_setopt($resource, CURLOPT_FAILONERROR, false);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
curl_setopt($resource, CURLOPT_HTTPHEADER, array("X-VTEX-API-AppKey: " . $key, "X-VTEX-API-AppToken: " . $token, "Accept: application/json", "Content-Type: application/json"));
$response = curl_exec($resource);
$info = curl_getinfo($resource);
$body = substr($response, -$info['download_content_length']);
Handler::$responseHeader = substr($response, 0, $info['header_size']);
curl_close($resource);
return $body;
}