Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <link href='https://fonts.googleapis.com/css?family=Oswald:300' rel='stylesheet' type='text/css'>
- <title>Tocando Agora</title>
- <style type="text/css">
- body {
- font-family: 'Oswald:300', sans-serif;
- color: #616161;
- background-color: #
- }
- </style>
- </head>
- <?php
- echo "<meta HTTP-EQUIV='refresh' CONTENT='15;URL='>";
- //extendendo a classe
- class SimpleXMLAttribute extends SimpleXMLElement
- {
- // metodo retorna o valor do atributo
- public function Attribute( $name )
- {
- // percorre os atributos
- foreach( $this->Attributes() as $key => $val )
- {
- // verifica existencia e retorna o valor
- if( $key == $name )
- {
- //converte/retorna valor string
- return (string) $val;
- }
- }
- }
- }
- // carregando o XML com o simplexml
- $xml = simplexml_load_file( "http://www.uruacufm.com.br/tocandoagora/ArquivoWEB.XML", 'SimpleXMLAttribute' );
- //percorrendo o nó faixa da playlist
- foreach( $xml->Atual as $Atual )
- {
- //printando valores e atributos
- echo
- $Atual->Programacao
- . "<br />"
- //retorna o atributo id passado ao método Attribute()
- . $Atual->Titulo
- . "<br />"
- . $Atual->Interprete
- . "<br />"
- ;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement