La fonction ci-dessous doit sortir une vignette Vimeo. Il ne retourne rien. J'ai testé pour $id
et il passe dans la fonction, et c'est un ID vimeo valide pour une vidéo. Quand je remplace le $out = xxx
avec $out = 'hello';
, rien ne sort. Cela m'amène à croire qu'aucun enregistrement n'est renvoyé dans l'appel xml. Curl 7.12.1 est installé. Quoi d'autre pourrait être un problème ici?CURL/PHP/Apache - Pourquoi cette requête CURL/Simplexml pour Vimeo ne fonctionnera-t-elle pas?
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;
}
Merci Sab. Il s'avère que je suis sur un serveur PHP4 donc simplexml_load_string ne fonctionnera pas. Pouvez-vous me donner un remplacement pour cela? – user151257
peut-être que cela aidera? http://www.webmaster-talk.com/php-forum/170192-problem-with-simplexml_load_string-and-php4.html –