php - 用于返回安全图像 URL 的 Amazon ECS API

标签 php amazon-web-services amazon

我正在使用 API 获取带有参数的产品列表:

'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',

我只从不安全的服务器接收图像,例如

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

我了解到这张图片也可以在 URL 下找到:

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

我可以让 API 在响应中返回安全 URL 吗?

最佳答案

我看到这是一个老问题。可能实际上还是。

您可以用简单的 str_replace 替换结果 url。

$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);

关于php - 用于返回安全图像 URL 的 Amazon ECS API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31856365/

相关文章:

linux - 亚马逊 EC2 : Unable to unmount and remove EBS drive file system

javascript - 如何在我的网站上使用 Mathquill

php - PHP中的触发错误函数是什么?

php - 直接从数组输出到 CSV 而不保存到 CSV 文件

amazon-web-services - 如何使用带有 Postfix 的 AWS SES 接收退回的邮件

node.js - Nodejs 使用 aws-sdk 删除 Amazon S3 上的文件夹

amazon-s3 - Amazon S3 上传错误 SSL 证书问题

php - 在数据映射器模式中创建对象数组

amazon-web-services - 第二个的目的是什么(Effect :Deny, Condition :Null) Statement of this S3 bucket policy?

php - 无法使用 amazon ses 将电子邮件发送到其他域