The below function should be outputting a Vimeo thumbnail. Its not returning anything. I have tested for $id and it is passing into the function, and it is a valid vimeo ID for a video. When I replace the $out = xxx with $out = 'hello'; , nothing comes out. This leads me to believe no records are being returned in the xml call. Curl 7.12.1 is installed. What else could be a problem here?
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;
}