Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon ECS API to return secure images URL

I'm using the API to get list of products with parameters:

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

I'm receiving images only from insecure server, e.g.

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

I have learned that this image is also available under the URL:

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

Can I make API to return the secure URL in the response?

like image 740
kuba Avatar asked Aug 06 '15 12:08

kuba


1 Answers

I see this is an old question. Probably still actually.

You can replace the result url with 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);
like image 171
Robert Avatar answered Oct 26 '22 23:10

Robert