viemo api を使用して動画を検索し、xml 形式で出力するサイトを作成しようとしています。私は良いスタートを切ったが、今は立ち往生している. ユーザー入力は投稿されていますが、firebug コンソールに結果が表示されません...
vimeo api 統合用の .php は次のとおりです。
<?
include('connect.php');
$video_id= $_POST['text'];
$url = 'http://vimeo.com/api/rest/v2';
$url .= '?';
$url .= 'method=vimeo.videos.search&';
$url .= 'oauth_consumer_key='.$api_key2.'&';
$url .= 'per_page=10&';
$url .= 'query='.$video_id.'&';
$url .= 'sort=relevant&';
$url .= 'full_response=1';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$curl_response = curl_exec($ch);
curl_close($ch);
$xmlObject = simplexml_load_string($curl_response);
$title= 'title';
$id = 'id';
$video_url = 'videosurl';
$thumbnails = 'thumbnail[1]';
$outputXML .= "";
$outputXML .= "<rsp>\n";
foreach($xmlObject->videos as $video) {
$videoTagBegin = "\t<video>\n";
$urlXML = "\t\t<videosurl>".$video->attributes()->$video_url."</videosurl>\n";
$titleXML = "\t\t<title>".$video->attributes()->$title."</title>\n";
$thumbXML = "\t\t<thumbnail>".$video->attributes()->$thumbnails."</thumbnail>\n";
$videoTagEnd = "\t</video>\n";
$outputXML .= $videoTagBegin.$titleXML.$thumbXML.$urlXML.$videoTagEnd;
}
$outputXML .= "</rsp>";
print $outputXML;
?>
どんな助けでも大歓迎です。私は完全に立ち往生しています。
それがまったく役立つなら、これは私のJSです....
function closeDivs(e) {
e.preventDefault();
$('').empty();
};
$(document).ready(function() {
$('#searchbtn').bind('click' || 'enter',function(e) {
if ($.trim($('#searchBox').val()) !== '') {
$('#videos').empty();
closeDivs(e);
$('#videos').append('<img src="img/loading.gif" alt="loading" class="loading" />');
getEvents(e);
getVideos(e);
}
});
function getEvents(e) {
e.preventDefault();
var text = 'event_id='+$('#searchBox').val();
$.ajax({
url: 'getEvents.php',
dataType: 'xml',
type: 'POST',
data: text,
success: function(data) {
},
error: function(data) {
console.log('Error: ' + data);
}
})
};
function getVideos(e) {
e.preventDefault();
var text = 'video_id='+$('#searchBox').val();
$.ajax({
url: 'getVideos.php',
dataType: 'xml',
type: 'POST',
data: text,
success: function(data) {
},
error: function(data) {
console.log('Error: ' + data);
}
})
};
});