jpb 2791
| Posté : 20-02-2007 22:26
<?php
$dev_id = "HSkI3UPljNU";// request your DEV_ID at http://www.youtube.com/signup?next=my_profile_dev
$account = "jipexu";//your youtube account name
$stream=file_get_contents("http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=$dev_id&user=$account");//get the xml file
//mise en tableau
preg_match_all('#<id>(.*?)</id>#',$stream,$regs); ;
$array_id=$regs[1];
srand ((double) microtime() * 10000000); // for old php...
$vid_ran = array_rand ($array_id, 3);//the second&nb sp;parameter
for($i=0; $i<count($vid_ran); $i++)
{
$id_ran=$vid_ran[$i];
$content.="<object width=\"200\" height=\"150\" title=\"Watch...\"><param name=\"movie\" value=\"http://www.youtube.com/v/$array_id[$id_ran]\"></param><param name=\"wmode\" value=\"transparent\"></param><!embed! src=\"http://www.youtube.com/v/$array_id[$id_ran]\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"200\" height=\"150\"></!embed!></object><br />";
}
?>
|