2

如何向 Amazon cloudfront API 发出 POST 控制请求?在文档中它说:

Send a CloudFront control API request that is similar to the following example.

POST /2012-05-05/origin-access-identity/cloudfront HTTP/1.1
[Required headers]  

<?xml version="1.0" encoding="UTF-8"?>
<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-05-05/">
  <CallerReference>20120229090000</CallerReference>   
  <Comment>Your comments here</Comment>
</CloudFrontOriginAccessIdentityConfig>

我四处寻找一些信息,但我不知道该怎么做。我可以通过像这里这样的卷曲请求来做些什么吗?

非常感谢任何帮助!此刻我感到有些失落。

非常感谢!

更新

我现在做这样的事情,仍然没有工作..有什么帮助吗?

<?php
$xml = 'POST /2012-05-05/origin-access-identity/cloudfront HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Date: [time stamp]
[Other required headers]    

<?xml version="1.0" encoding="UTF-8"?>
<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-05-05/">
   <CallerReference>ref</CallerReference>
   <Comment>The comment.</Comment>
</CloudFrontOriginAccessIdentityConfig>
';

$opts = array(
    'http'=>array(
        'method'=>'POST',
        'header'=>"Content-Type: text/plain\r\n" .
            $auth."\r\n",
        'content'=>$xml
    )
);

$context = stream_context_create($opts);
$url = 'https://cloudfront.amazonaws.com/2012-05-05/origin-access-identity/cloudfront';
$fp = fopen($url, 'r', false, $context);
fpassthru($fp);
$response = stream_get_contents($fp);
print_r($response);
fclose($fp);
?>
4

1 回答 1

1

FireFox 附加海报必须提供帮助。 https://addons.mozilla.org/en-US/firefox/addon/poster/ 其他类似工具: 是否有允许向网页发送任意 POST 数据的 Firefox 扩展(或任何其他浏览器)?

于 2012-06-12T03:54:02.320 回答