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