Amazon ECS API for returning protected image URLs

I use the API to get a list of products with parameters:

'Keywords' => 'search, 'Operation' => 'ItemSearch', 'SearchIndex' => 'All', 'AssociateTag' => 'my-tag', 'AWSAccessKeyId' => 'my-key-id', 'ResponseGroup' => 'Medium', 'Service' => 'AWSECommerceService', 'Timestamp' => gmdate('Ymd\TH:i:s\Z'), 'Version' => '2010-09-01', 

I only receive images from an insecure server, for example

 http://ecx.images-amazon.com/images/I/417YQ3xWx7L._SL75_.jpg 

I found out that this image is also available at the URL:

 https://images-na.ssl-images-amazon.com/images/I/417YQ3xWx7L._SL75_.jpg 

Can I force the API to return a secure URL in response?

+8
php amazon amazon-web-services
source share
2 answers

I see that this is an old question. Probably in fact.

You can replace the result URL with a simple str_replace.

 $image-url = "http://ecx.images-amazon.com/images/I/417YQ3xWx7L._SL75_.jpg" $new-image-url = str_replace('http://ecx.', 'https://images-na.ssl-', $image-url); 
+8
source share

No, and why do you need it? Normally, DNS does not change, so the URL will always remain the same.

I usually put these URLs in a configuration file, so it's easy to change them if I ever need to. then whenever you need a secure URL, just extract it from the config and add with the image name.

The only thing I need from amazon is the actual image name

-3
source share

All Articles