user4826347 user4826347 - 1 month ago 10
PHP Question

Unable to add XML Dom to AWS S3 bucket

I am trying to generate an xml on the fly using XMLDocument and add to a folder in the AWS S3 bucket

public static function putXML_To_Bucket($bucket, $dom, $location) {
$rest = new S3Request('PUT', $bucket, $location);
$rest->data = $dom->saveXML();
$rest->size = strlen($rest->data);
$rest->setHeader('Content-Type', 'application/xml');
$rest = $rest->getResponse();

if ($rest->error === false && $rest->code !== 200)
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false) {
trigger_error(sprintf("S3::putBucket({$bucket}, {$acl}, {$location}): [%s] %s",
$rest->error['code'], $rest->error['message']), E_USER_WARNING);
return false;
return true;

The var_dump($rest) produces this error

object(stdClass)#9 (1) {
array(3) {
string(63) "SSL certificate problem: unable to get local issuer certificate"
string(34) "/mybucket/"

Note I am developing from localhost.

I don't have a clue why this is happening. Any help would be much appreciated.

Answer Source

J.Garth's note helped me solve the issue. Thanks

Stackoverflow suggestion by J Garth