1. Go to this page and download the library: Download ericnorris/amazon-s3-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class S3Response {
public $error; // null if no error
public $code; // response code from AWS
public $headers; // response headers from AWS
public $body; // response body from AWS
}
$client = new S3(ACCESS_KEY, SECRET_KEY);
// [OPTIONAL] Specify different curl options
$client->useCurlOpts(array(
CURLOPT_MAX_RECV_SPEED_LARGE => 1048576,
CURLOPT_CONNECTTIMEOUT => 10
));
$error = array(
'code' => xxx, // error code from either curl or AWS
'message' => xxx, // error string from either curl or AWS
'resource' => [optional] // the S3 resource frmo the request
)