- file_get_contents: documentation ( source)
<?php
$total_seconds = 0;
$dom = new DOMDocument();
$dom->loadXML(file_get_contents('http://gdata.youtube.com/feeds/api/playlists/PLZlv_N0_O1gaCL2XjKluO7N2Pmmw9pvhE'));
$xpath = new DOMXPath($dom);
foreach ($xpath->query('//yt:duration/@seconds') as $duration)
{
$total_seconds += (int) $duration->value;
}
echo (int) ($total_seconds / 3600) . ':' . (int) ($total_seconds / 60) % 60 . ':' . $total_seconds % 60;