Warning: file_get_contents(http://rita.nrk.no/community/klanen/daletlister/index.php?visDato=20180223&Time=01&sok=vis): failed to open stream: HTTP request failed! HTTP/1.1 410 Gone in /var/www/www/mp3_spillelista.php on line 8

Notice: Undefined offset: 1 in /var/www/www/mp3_spillelista.php on line 20

Warning: array_pop() expects parameter 1 to be array, null given in /var/www/www/mp3_spillelista.php on line 49
Nå spilles av

<?php


$date 
date("Ymd");
$time date("H");

//echo 'http://rita.nrk.no/community/klanen/daletlister/index.php?visDato='.$date.'&Time='.$time.'&sok=vis';
$file file_get_contents('http://rita.nrk.no/community/klanen/daletlister/index.php?visDato='.$date.'&Time='.$time.'&sok=vis');

$html = array         (
                
'/(.*?)\<table cellpadding\=3\>(.*?)/si'
            
);
$replace = array    (
                
'$2'
            
);
$pars preg_replace($html$replace$file);


$explode explode('<td colspan=3>',$pars);
$pars $explode[1];

$html = array         (
                
'/(.*?)\<td\>.?\<b\>(.*?)\<\/b\> \<\/td\>/si',
                
'/(.*?)\<tr\>(.*?)\<\/tr\>/si',
                
'/(.*?)\<td(.*?)\>(.*?)\<\/td\>/si'
            
);
$replace = array    (
                
'$1$3',
                
"<entry>\n$2\n</entry>\n",
                
"$1<item>$3</item>$4\n"
            
);
$pars str_replace('<tr>'''preg_replace($html$replace$pars));

$xml_start '<?xml version="1.0" encoding="ISO-8859-1"?><playlist>';

$xml_raw =  $xml_start.$pars.'</playlist>';

$xml = new SimpleXMLElement($xml_raw);

$a=0;
foreach(
$xml->entry as $entry)
{
    
$a++;
    
$b 0;
    
        foreach(
$entry as $key => $item)
            
$entry_array[$a][$b++] = (string)$item;
}
$now array_pop($entry_array);
$artist trim($now[0]);
$name trim($now[1]);
$time trim($now[2]);
?>
Nå spilles <strong><?php echo $name.'</strong> av <strong>'.$artist;?></strong>
<br>
<br>
<?php 
show_source
('mp3_spillelista.php'); ?>