Sample code for 30+ languages & platforms
PHP

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Http;

$http = new Http();

// Insert your AWS keys here:
$http->AwsAccessKey = 'AWS_ACCESS_KEY';
$http->AwsSecretKey = 'AWS_SECRET_KEY';

$bucketName = 'chilkat.ocean';
$objectName = 'seahorse.jpg';
$http->AwsRegion = 'us-west-2';
$http->AwsEndpoint = 's3-us-west-2.amazonaws.com';

$retval = $http->S3_FileExists($bucketName, $objectName);
if ($retval < 0) {
    echo "Failed to check for the S3 object existence\n";
    echo $http->LastErrorText, "\n";
    exit;
}

if ($retval == 0) {
    echo "The S3 object does not exist.\n";
    exit;
}

echo "The S3 object exists.\n";