PHP XML Parser脚本与Brightcove API交互

时间:2014-10-11 20:47:50

标签: php parsing simplexml brightcove

新手在这里,所以忍受我:

我有一个简单有效的PHP脚本,用于解析包含视频文件URL,元数据等的API MRSS提要:

<?php
$html = "";
$url = "http://api.brightcove.com/services/library?command=search_videos&any=tag:SMGV&output=mrss&media_delivery=http&sort_by=CREATION_DATE:DESC&token= // this is where the API token goes";
$xml = simplexml_load_file($url);
$namespaces = $xml->getNamespaces(true); // get namespaces

for($i = 0; $i < 80; $i++){
  $title = $xml->channel->item[$i]->video;
  $link = $xml->channel->item[$i]->link;
  $title = $xml->channel->item[$i]->title;
  $pubDate = $xml->channel->item[$i]->pubDate;
  $description = $xml->channel->item[$i]->description;
  $titleid = $xml->channel->item[$i]->children($namespaces['bc'])->titleid;
  $html .= "<h3>$title</h3>$description<p>$pubDate<p>$link<p>Video ID: $titleid<p>
    <iframe width='480' height='270' src='http://link.brightcove.com/services/player/bcpid3742068445001?bckey=AQ~~,AAAABvaL8JE~,ufBHq_I6FnyLyOQ_A4z2-khuauywyA6P&bctid=$titleid&autoStart=false' frameborder='0'></iframe><hr/>";/* this embed code is from the youtube iframe embed code format but is actually using the embedded Ooyala player embedded on the Campus Insiders page. I replaced any specific guid (aka video ID) numbers with the "$guid" variable while keeping the Campus Insider Ooyala publisher ID, "eb3......fad" */
}
echo $html;
?>

如何更改此脚本以便输出到Brightcove's API via the create_video method?在谈到如何处理脚本输出并将其插入API时,我有点不知所措。

感谢您提供的任何建议,我真的很感激。

0 个答案:

没有答案