更新时间:2017-06-07 13:26
媒体转码的转码任务是异步的接口,提交转码任务后,可以通过消息通知功能,接收转码任务结果。
详细说明参见:【点此查看】
由于目前消息接受URI必须为/notifacations,所以如果使用php处理消息的话,需要在web服务器上配置rewite。
以nginx为例,需要在配置中添加红色的一行,(revive_msg.php为实际接收转码任务消息的php页面)
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /www/php;
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
rewrite "^/notifications$" /revive_msg.php break;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|exe)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
location ~ .*\.(txt)?$
{
add_header Cache-Control no-cache;
}
修改后,重启nginx是配置生效,这样当消息推送到/notifacations时,实际会由revive_msg.php进行处理。
附 消息处理的php代码:
//$xml = $HTTP_RAW_POST_DATA;
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
//将xml数据写入文本文件"msg.txt"中,实际处理时,可以解析XML后根据任务执行结果进行后续的处理
$handle = fopen('msg.txt','a+');
fwrite($handle,$xml);
//返回状态必须为204,不能是200或其他的状态码,否则会认为消息推送失败
http_response_code(204);
?>
如果问题还未能解决,请联系售后技术支持。
在文档使用中是否遇到以下问题
更多建议
匿名提交