Scalr\Service\Aws\S3\V20060301\S3Api::getObjectMetadata PHP Method

getObjectMetadata() public method

The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object. A HEAD request has the same options as a GET operation on an object. The response is identical to the GET response, except that there is no response body.
public getObjectMetadata ( string $bucketName, string $objectName, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string A bucket name.
$objectName string An object name.
$requestHeaders array optional Range headers looks like array(header => value)
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response object on success or throws an exception
    public function getObjectMetadata($bucketName, $objectName, array $requestHeaders = null)
    {
        $result = null;
        $options = array('_subdomain' => (string) $bucketName);
        $allowedHeaders = self::$rangeHeaders;
        if (!empty($requestHeaders)) {
            $requestHeaders = $this->getFilteredArray($allowedHeaders, $requestHeaders);
            $options = array_merge($options, $requestHeaders);
        }
        $response = $this->getClient()->call('HEAD', $options, sprintf('/%s', self::escapeObjectName($objectName)));
        return $response->getError() ?: $response;
    }