praticamente ogni
<id>tag:youtube.com,2008:video:JG2csRgFaRo</id>
a me serve solo quello che viene dopo video:
Codice PHP:
<?php
function download_page($path){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$path);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$retValue = curl_exec($ch);
curl_close($ch);
return $retValue;
}
$url='http://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2';
$sXML = download_page($url);
$oXML = new SimpleXMLElement($sXML);
//da qui in poi non so che fare
foreach($oXML->entry as $oEntry){
$id_video = end(explode('/', $oEntry->id));
$title = end(explode('/', $oEntry->title));
echo $id_video .'
';
echo $title .'
';
}
?>