如何在 Amazon cloudfront API 上执行 POST 请求



如何向 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>

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

任何帮助非常感谢!此刻我感到有点迷茫。

非常感谢!

更新

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

<?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/plainrn" .
            $auth."rn",
        '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);
?>

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

最新更新