YouTube Data API のカスタム パラメータ
https://developers.google.com/youtube/2.0/reference#Searching_for_videos<?php
/*
https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters#keysp
YouTube API
*/
?>
<?php
$g=$_GET['g'];
$x=new YoutubeAPI($g);
class YoutubeAPI{
public function YoutubeAPI($key){
$API_URL='http://gdata.youtube.com/feeds/api/videos?';
$para['client']='dodofei.com';
$para['format']='5';
$para['q']=$key;
$para['max-results']='5';
$para['key']='AI***********************************Uw';
$para['v']='2';
$paras=http_build_query($para);
$xmlurl= $API_URL.$paras;
$data=simplexml_load_file($xmlurl);
//echo '<pre>';
//print_r($data);
if($data->entry){
foreach ($data->entry as $key=>$val){
$l=explode(':', $val->id);
$ll[count($ll)]=$l['3'];
}
echo implode('|',$ll);
}else{
echo 'nodata';
}
}
}
?>