Gets the HTTP headers for the specified Amazon S3 object.
The MD5 value for an object can be retrieved from the ETag HTTP header for any object that was uploaded with a normal PUT/POST. This value is incorrect for multipart uploads.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Required |
The file name for the object. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Get the headers for an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->get_object_headers($bucket, 'prefix with spaces/åéîøü/åéîøü/åéîøü with spaces.txt'); // Success? var_dump($response->isOK());Result:
bool(true)
Get the headers for a specific version of an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); // HEAD a specific version $response = $s3->get_object_headers($bucket, 'test1.txt', array( 'versionId' => '0NNAq8PwvXvg8EfAYG9sSmwKTZeixZgZNE6PbodG8td0DJ3gVOmjI2Gh/oFnb0Ie=' )); // Success? var_dump($response->isOK()); var_dump(strpos((string) $response->header['_info']['url'], 'versionId=' . '0NNAq8PwvXvg8EfAYG9sSmwKTZeixZgZNE6PbodG8td0DJ3gVOmjI2Gh/oFnb0Ie=') !== false);Result:
bool(true) bool(true)
Source
Method defined in services/s3.class.php | Toggle source view (10 lines) | View on GitHub