lundi 7 avril 2014

services de web d'Amazone - Amazone s3 implimentation en php ne fonctionne ne pas - Stack Overflow


I am trying to integrate amazone api for uploading content directly. When i integrate this i got an error


$aws_key    = example key;
$aws_secret = example secret key;

$source_file = 'test.jpg'; // file to upload to S3

$file_type = "image/jpg"; // or other file type like "image/jpeg" for JPEG image,
// or "binary/octet-stream" for binary file

$aws_bucket = 'bucket_example'; // AWS bucket
$aws_object = 'test.jpg'; // AWS object name (file name)


if (strlen($aws_secret) != 40) die("$aws_secret should be exactly 40 bytes long");
$file_data = file_get_contents($source_file);
if ($file_data == false) die("Failed to read file ".$source_file);


// opening HTTP connection to Amazon S3
$fp = fsockopen("s3.amazonaws.com", 80, $errno, $errstr, 30);
if (!$fp) {
die("$errstr ($errno)\n");
}

I got this error


AmazonS3 2eb SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.

I double check the keys. There is no mistake in keys. if any one know about this please help me.



I am trying to integrate amazone api for uploading content directly. When i integrate this i got an error


$aws_key    = example key;
$aws_secret = example secret key;

$source_file = 'test.jpg'; // file to upload to S3

$file_type = "image/jpg"; // or other file type like "image/jpeg" for JPEG image,
// or "binary/octet-stream" for binary file

$aws_bucket = 'bucket_example'; // AWS bucket
$aws_object = 'test.jpg'; // AWS object name (file name)


if (strlen($aws_secret) != 40) die("$aws_secret should be exactly 40 bytes long");
$file_data = file_get_contents($source_file);
if ($file_data == false) die("Failed to read file ".$source_file);


// opening HTTP connection to Amazon S3
$fp = fsockopen("s3.amazonaws.com", 80, $errno, $errstr, 30);
if (!$fp) {
die("$errstr ($errno)\n");
}

I got this error


AmazonS3 2eb SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.

I double check the keys. There is no mistake in keys. if any one know about this please help me.


0 commentaires:

Enregistrer un commentaire