Advertisement
charlesfctdb

Untitled

May 5th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <link href='https://fonts.googleapis.com/css?family=Oswald:300' rel='stylesheet' type='text/css'>
  6. <title>Tocando Agora</title>
  7. <style type="text/css">
  8. body {
  9. font-family: 'Oswald:300', sans-serif;
  10. color: #616161;
  11. background-color: #
  12. }
  13. </style>
  14. </head>
  15. <?php
  16. echo "<meta HTTP-EQUIV='refresh' CONTENT='15;URL='>";
  17. //extendendo a classe
  18. class SimpleXMLAttribute extends SimpleXMLElement
  19. {
  20. // metodo retorna o valor do atributo
  21. public function Attribute( $name )
  22. {
  23. // percorre os atributos
  24. foreach( $this->Attributes() as $key => $val )
  25. {
  26. // verifica existencia e retorna o valor
  27. if( $key == $name )
  28. {
  29. //converte/retorna valor string
  30. return (string) $val;
  31. }
  32. }
  33. }
  34. }
  35. // carregando o XML com o simplexml
  36. $xml = simplexml_load_file( "http://www.uruacufm.com.br/tocandoagora/ArquivoWEB.XML", 'SimpleXMLAttribute' );
  37. //percorrendo o nó faixa da playlist
  38. foreach( $xml->Atual as $Atual )
  39. {
  40. //printando valores e atributos
  41. echo
  42. $Atual->Programacao
  43. . "<br />"
  44. //retorna o atributo id passado ao método Attribute()
  45. . $Atual->Titulo
  46. . "<br />"
  47. . $Atual->Interprete
  48. . "<br />"
  49. ;
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement