本文整理匯總了PHP中Buzz\Browser::head方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::head方法的具體用法?PHP Browser::head怎麽用?PHP Browser::head使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Buzz\Browser
的用法示例。
在下文中一共展示了Browser::head方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: b2DownloadFileByName
/**
* Downloads one file by providing the name of the bucket and the name of the file.
*
*
* @param String $downloadURL Obtained from b2AuthorizeAccount call
* @param string $bucketName The bucket name of file
* @param string $fileName The name of the file, in percent-encoded UTF-8
* @param string $token Can be null if your bucket is public otherwise An upload authorization token from authorization request
* @param bool $metadataOnly True for headers array, False for content too
*
* @return B2Response
*
* @throws B2Exception
*/
public function b2DownloadFileByName($downloadURL, $bucketName, $fileName, $token = null, $metadataOnly = false)
{
$uri = $downloadURL . '/file/' . $bucketName . '/' . $fileName;
$curl = $this->prepareCurl();
if (is_null($token)) {
$curl->setVerifyPeer(false);
// ensure it.
}
$browser = new Browser($curl);
if (is_null($token)) {
$headers = [];
} else {
$headers = $this->getHeaders($token);
}
$response = $metadataOnly ? $browser->head($uri, $headers) : $browser->get($uri, $headers);
return new B2Response($response, false);
}