Php 如何获取信息视频(redtube)
我的剧本:Php 如何获取信息视频(redtube),php,Php,我的剧本: function redtube_search($search, $page) { $feedurl = 'http://api.redtube.com/?data=redtube.Videos.searchVideos&output=json&search='.$search.'&thumbsize=big&page='.$page; $ch = curl_init(); $timeout = 15; curl_set
function redtube_search($search, $page) {
$feedurl = 'http://api.redtube.com/?data=redtube.Videos.searchVideos&output=json&search='.$search.'&thumbsize=big&page='.$page;
$ch = curl_init();
$timeout = 15;
curl_setopt($ch,CURLOPT_URL,$feedurl);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
$content = json_decode($data,true);
return $content;
}
$videos = redtube_search('teen',1);
print_r($videos);
如何分配变量:标题、拇指、持续时间
我想处理下载的内容。试试这个
foreach($videos['videos'] as $v){
// title, thumbs, duration?
$title = $v['video']['title'];
$thumb = $v['video']['thumb'];
$duration = $v['video']['duration'];
echo "Title: {$title}<br> Duration: {$duration}<br> Thumb: {$thumb}<br>";
}
foreach($videos['videos']作为$v){
//标题、大拇指、持续时间?
$title=$v['video']['title'];
$thumb=$v['video']['thumb'];
$duration=$v['video']['duration'];
echo“Title:{$Title}
Duration:{$Duration}
Thumb:{$Thumb}
”;
}
谢谢!如何显示全部?现在只显示一个