Perl
Perl
Example: Http.S3_FileExists method
Demonstrates theS3_FileExists method.
Chilkat Perl Downloads
use chilkat();
$http = chilkat::CkHttp->new();
# Insert your AWS keys here:
$http->put_AwsAccessKey("AWS_ACCESS_KEY");
$http->put_AwsSecretKey("AWS_SECRET_KEY");
$bucketName = "chilkat.ocean";
$objectName = "seahorse.jpg";
$http->put_AwsRegion("us-west-2");
$http->put_AwsEndpoint("s3-us-west-2.amazonaws.com");
$retval = $http->S3_FileExists($bucketName,$objectName);
if ($retval < 0) {
print "Failed to check for the S3 object existence" . "\r\n";
print $http->lastErrorText() . "\r\n";
exit;
}
if ($retval == 0) {
print "The S3 object does not exist." . "\r\n";
exit;
}
print "The S3 object exists." . "\r\n";