如何对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/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);
?>
你想知道什么? 您尝试的示例是通过Post Request创建Origin Access Identity。所以首先澄清你想要什么?你面临什么问题? **创建分发** http://docs.amazonwebservices.com/AmazonCloudFront/2012-05-05/APIReference/CreateDistribution.html **创建原始访问身份。** http://docs.amazonwebservices.com/ AmazonCloudFront/2012-05-05/APIReference/CreateOAI.html –
它说:“要创建新的CloudFront原始访问身份,请在2012-05-05/origin-access-identity/cloudfront资源上执行POST。”我如何发送POST?这是我通过Curl必须做的吗? – Mike