curl -s https://getcomposer.org/installer | php
php composer.phar install
Read the documentation for the ZendService\Amazon component.
License: BSD 3-Clause "New" or "Revised" License
curl -s https://getcomposer.org/installer | php
php composer.phar install
Read the documentation for the ZendService\Amazon component.
Hello everybody,
I have an issue with the basic example script provide in the Amazon doc (http://zf2.readthedocs.org/en/latest/modules/zendservice.amazon.s3.html) which look like this:
public function testAWSUpload()
{
$my_aws_key = 'XXXXXXXXXXXXXXXXXXXXXXX';
$my_aws_secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$s3 = new S3\S3($my_aws_key, $my_aws_secret_key);
$list = $s3->getBuckets();
In debug mode this code throw me an HTTP 403 Forbidden. Here is the request:
GET / HTTP/1.1
Host: s3.amazonaws.com
Connection: close
Accept-Encoding: gzip, deflate
User-Agent: Zend\Http\Client
Content-Type: application/xml
Date: Thu, 08 Oct 2015 16:01:58 GMT
Authorization: AWS XXXXXXXXXXXXXXXXXX:pyGz5Fjvqo2ahnmHq78/nfV5p9M=
And there is the response:
HTTP/1.1 403 Forbidden
x-amz-request-id: F84DE8F4433CA8C3
x-amz-id-2: pK7eAIyPEIMtaYNWDUHLX8qIqRJVCdqKX6alDGlWJKL2ikKZTsKACkiP0mOt5jidYDJvQ2zAQJk=
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Thu, 08 Oct 2015 16:01:58 GMT
Server: AmazonS3
2eb
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.XXXXXXXXXXXXXXXXXXXXXXGET
application/xml
Thu, 08 Oct 2015 16:01:58 GMT
/pyGz5Fjvqo2ahnmHq78/nfV5p9M=47 45 54 0a 0a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 6d 6c 0a 54 68 75 2c 20 30 38 20 4f 63 74 20 32 30 31 35 20 31 36 3a 30 31 3a 35 38 20 47 4d 54 0a 2fF84DE8F4433CA8C3pK7eAIyPEIMtaYNWDUHLX8qIqRJVCdqKX6alDGlWJKL2ikKZTsKACkiP0mOt5jidYDJvQ2zAQJk=
0
I test my AWS KEY and AWS SECRET KEY on this site who return me the good name and canonical ID: http://www.bucketexplorer.com/awsutility.aspx
Anobody have a clue on what's happening?
Thank you
I was curious whether there were plans to port this package to ZF3. I regularly build with a CMS based on ZF which recently upgraded from 2 to 3. Would love to have assets stored on S3 as seamlessly as before.
If there aren't plans, would be happy to contribute to the extent that I'm able.
Thanks!
AbstractEc2::setRegion() writes to $_defaultRegion. But $_defaultRegion is only used in the Constructor if you dont provide an region. In all other cases $_region is used.
So if you have an instance of eg ZendService\Amazon\Ec2\Instance and use setRegion its not used at all.
Fix:
Line 104 in AbstractEc2 change to: self::$_region = $region;
This library seems to only do signing with v2, no v4. Region eu-central-1 does not support v2
The date format for Zend\Http\Client seems to have changed from ZF 2.2.4 to ZF 2.2.5. Previously, the date was formatted as "Sun, 03 Nov 2013 15:07:45 -0500". However, starting with ZF 2.2.5 the format is "Sun, 03 Nov 2013 20:07:45 GMT". (I couldn't yet nail down exactly why, but was able to "resolve" it by replacing ZF 2.2.5's \Zend\Http directory with ZF 2.2.4's.).
This impacts the AWS Request Signature due to the mismatch with how \ZendService\Amazon\S3\S3::getRequestDate()
generates the signature.
I've patched that method using
$date = new \DateTime('now', new \DateTimeZone('GMT'));
return $date->format('D, d M Y H:i:s \G\M\T');
which matches how \Zend\Http\Header\AbstractDate::setDate()
works.
Thanks!
$sqs = new Sqs(self::ACCESS_KEY_ID, self::SECRET_KEY, "eu-west-1");
gives
Argument 3 passed to ZendService\Amazon\AbstractAmazon::__construct() must be an instance of Zend\Http\Client, string given, called in .../vendor/zendframework/zendservice-amazon/library/ZendService/Amazon/Sqs/Sqs.php on line 61
error.
Thanks.
Hello,
Is it possible to add IT, ES, CN and BR countries please ?
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/SOAPEndpoints.html
Thanks!
I've created PR with PHP 7.3 support but the build on travis didn't start.
I've checked on travis website and I've got:
Some books seem to have extended imagesets containing back covers. The Zend AmazonService included the back cover for many books instead of the front cover.
Fixed in: https://github.com/troxler/ZendService_Amazon/commit/9ef18b788377fc565f0c3c3f3145a29e79222184
In https://github.com/zendframework/ZendService_Amazon/blob/master/library/ZendService/Amazon/S3/Stream.php#L175 is an off-by-one error:
Imagine you want to read a larger file (450215 bytes) using PHP's readfile
function.
On first attempt, stream_read
will be called with $count
set to 8192 with the result that $range_start
will be 0 (because it is the first call) and $range_end
will be set to 0+8192=8192
. This will be used as Range header 0-8192 which will actually read 8193 bytes (see http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7233.html#header.content-range) which you can see when you check length of $response->getBody()
later.
The problem is now that we set $this->_objectBuffer
to the larger value but extract only 8192 bytes via $data = substr($this->_objectBuffer, $this->_position, $count);
and set position based on strlen($data)
.
So while we use the correct position on our next stream_read
call but $this_>_objectBuffer
is larger than expected we will miss (truncate) data.
Quick fix: Change
$range_end = $this->_position+$count;
into
$range_end = $this->_position+$count-1;
Now we are really only requesting $count
bytes and $this->_objectBuffer
contains exactly what we have already processed so we don't miss (truncate) any data anymore.
The advertising API returns RequestThrottled
errors when too many requests were made. Currently there seems to be no way to differentiate such errors from searches with no results. To overcome this limitation a method like the one below should be added to the ResultSet
class.
public function hasError()
{
return ($this->_xpath->evaluate('name(/*)') == 'ItemSearchErrorResponse');
}
PA API 4 will sunset on October 31st 2019.
Upgrade to PA API 5.0 is necessary in order for the package to function after said date.
Anyone working on this currently?
The php function file_exists() uses the the stream wrapper function url_stat()
Unfortunately \ZendService\Amazon\S3\Stream function url_stat always return a value even if the file does not exists
It means that everytime you uses file_exists() it always return true .
I only tested using FakeS3 - which simulate an amazon s3 "server" https://github.com/jubos/fake-s3
So it might be related but looking at the url_stat function I am pretty certain this is not caused by FakeS3
/**
* Return array of URL variables
*
* @param string $path
* @param integer $flags
* @return array
*/
public function url_stat($path, $flags)
{
$stat = array();
$stat['dev'] = 0;
$stat['ino'] = 0;
$stat['mode'] = 0777;
$stat['nlink'] = 0;
$stat['uid'] = 0;
$stat['gid'] = 0;
$stat['rdev'] = 0;
$stat['size'] = 0;
$stat['atime'] = 0;
$stat['mtime'] = 0;
$stat['ctime'] = 0;
$stat['blksize'] = 0;
$stat['blocks'] = 0;
$name = $this->_getNamePart($path);
if(($slash = strchr($name, '/')) === false || $slash == strlen($name)-1) {
/* bucket */
$stat['mode'] |= 040000;
} else {
$stat['mode'] |= 0100000;
}
$info = $this->_getS3Client($path)->getInfo($name);
if (!empty($info)) {
$stat['size'] = $info['size'];
$stat['atime'] = time();
$stat['mtime'] = $info['mtime'];
}
return $stat;
}
I believe it should be
public function url_stat($path, $flags) {
$stat = array();
$stat['dev'] = 0;
$stat['ino'] = 0;
$stat['mode'] = 0777;
$stat['nlink'] = 0;
$stat['uid'] = 0;
$stat['gid'] = 0;
$stat['rdev'] = 0;
$stat['size'] = 0;
$stat['atime'] = 0;
$stat['mtime'] = 0;
$stat['ctime'] = 0;
$stat['blksize'] = 0;
$stat['blocks'] = 0;
$name = $this->_getNamePart($path);
if (($slash = strchr($name, '/')) === false || $slash == strlen($name) - 1) {
/* bucket */
$stat['mode'] |= 040000;
} else {
$stat['mode'] |= 0100000;
}
$info = $this->_getS3Client($path)->getInfo($name);
if (!empty($info)) {
$stat['size'] = $info['size'];
$stat['atime'] = time();
$stat['mtime'] = $info['mtime'];
return $stat;
}
return false;
}
When an invalid response was returned by Amazon (e.g. RequestThrottled
), using ResultSet::totalResults()
results in the following error:
Notice: Trying to get property of non-object in /.../ZendService/Amazon/ResultSet.php on line 73.
That method should first check whether or not the response is valid.
Using e.g. curl_multi()
it is possible to do HTTP requests in parallel. This technique would decrease the loading time in situations where more than one requests need to be done. This makes also a lot of sense when retrieving information from APIs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.