php - 如何创建 PHP 函数来创建对 AWS 的 JSON 请求(创建作业)

标签 php json amazon-web-services

AWS 上有一项名为 Elastic Transcoder 的新服务。我了解一些 PHP,但我对这方面的了解已经超出了我的能力...

我将如何创建一个简单的 PHP 函数,该函数将获取我的变量并创建 JSON 请求(当然格式正确)并在 AWS 上创建作业。以下是 AWS 提供的语法:

注意:我已经创建了一个表单,它将能够提供所有必填字段。

To create a job, send a POST request to the

/2012-09-25/jobs

resource.

这是语法:

POST /2012-09-25/jobs HTTP/1.1
Content-Type: application/json; charset=UTF-8
Accept: */*
Host: elastictranscoder.Elastic Transcoder endpoint.amazonaws.com:443
x-amz-date: Mon, 14 Jan 2013 17:49:52 GMT
Authorization: AWS4-HMAC-SHA256 
           Credential=AccessKeyID/request-date/Elastic Transcoder endpoint/ets/aws4_request,
           SignedHeaders=host;x-amz-date;x-amz-target,
           Signature=calculated-signature
Content-Length: number of characters in the JSON string
{
"Input":{
  "Key":"name of the file to transcode",
  "FrameRate":"auto"|"10"|"15"|"23.97"|"24"|"25"|"29.97"|"30"|"60",
  "Resolution":"auto"|"width in pixelsxheight in pixels",
  "AspectRatio":"auto"|"1:1"|"4:3"|"3:2"|"16:9",
  "Interlaced":"auto"|"true"|"false",
  "Container":"auto"|"3gp"|"asf"|"avi"|"divx"|"flv"|"mkv"|"mov"|"mp4"|
     "mpeg"|"mpeg-ps"|"mpeg-ts"|"mxf"|"ogg"|"vob"|"wav"|"webm"
},
"Output":{
  "Key":"name of the transcoded file",
  "ThumbnailPattern":""|"pattern",
  "Rotate":"auto"|"0"|"90"|"180"|"270",
  "PresetId":"preset to use for the job"
},
"PipelineId":"pipeline to add the job to"
}

上述代码中需要提供的部分在语法的原始发布中以斜体显示:

http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/create-job.html#create-job-examples

最佳答案

AWS SDK for PHP包括对 Amazon Elastic Transcoder 的支持。您有什么理由不想使用它吗? Here是 PHP SDK 文档的链接。

关于php - 如何创建 PHP 函数来创建对 AWS 的 JSON 请求(创建作业),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15482408/

相关文章:

php - mysql比较produst的前两个单词并给出最低价格

php - 山魈验证错误

javascript - 如何将json url显示为html?

linux - Laravel 没有从 env 文件中获取默认的 DB_CONNECTION 值

git aws.push 返回 "error: RPC failed; result=22, HTTP code = 400"

php - 使用 PHP 获取 DLNA 信息

PHP MySQL 搜索功能

php - 在 xmlHTTPrequest send() 之后从 PHP $_POST 访问 ArrayBuffer

javascript - 删除后刷新 JSON

mysql - Golang aws xray.sql错误