以下の関数は、Vimeo サムネイルを出力する必要があります。何も返さない。テストしまし$id
たが、関数に渡されており、ビデオの有効な vimeo ID です。を に置き換える$out = xxx
と
$out = 'hello';
、何も出てきません。これにより、xml 呼び出しでレコードが返されていないと思われます。Curl 7.12.1 がインストールされています。ここで他に何が問題になる可能性がありますか?
function vimeo_thumbnail()
{
global $TMPL, $DB, $SESS;
$video_id = $TMPL->fetch_param('id');
if(!$video_id) {
return;
}
// API endpoint
$api_endpoint = 'http://www.vimeo.com/api/v2/video/'.$video_id.'.xml';
// Curl helper function
function curl_get($url) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
$return = curl_exec($curl);
curl_close($curl);
return $return;
}
// Load the user info and clips
$video_info = simplexml_load_string(curl_get($api_endpoint));
foreach ($video_info->video as $video) {
$out = '<img src="'.$video->thumbnail_medium.'" />';
}
$this->return_data .= $out;
}