【问题标题】:Amazon ECS API to return secure images URL用于返回安全图像 URL 的 Amazon ECS API
【发布时间】:2015-10-29 15:17:49
【问题描述】:

我正在使用 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 吗?

【问题讨论】:

    标签: php amazon-web-services amazon


    【解决方案1】:

    我看到这是一个老问题。实际上可能仍然存在。

    您可以用简单的 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);
    

    【讨论】:

    • 这很棒,我认为亚马逊不会很快更改这些 https URL 是安全的,因为许多其他网站都依赖它们。谢谢!
    • 这太棒了……对于北美来说。我们需要一个替代世界其他地方的维基!有人知道吗?
    • 同意这是个好消息。如果用户没有看到绿色的 https 符号,他们可能会在网站上感到不安全。他们可能不觉得这是合法的。尽管我可能不会检索敏感数据,但有绿色符号看起来仍然很棒,所以谢谢
    猜你喜欢
    • 2019-02-24
    • 2014-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多