Jump to content

am i missing something?


flemingmike

Recommended Posts

ok, here is my new code, nothing being displayed though.  any ideas?

 

<?php 

function getmusic() {

$requestAddress = "http://www.durhamit.ca:8181/1.0/?method=player.GetNowPlayingData";
$xml_str = file_get_contents($requestAddress,0);
// Parses XML
$xml = new SimplexmlElement($xml_str);
// Loops XML
$count = 0;
echo <<< END

END;


echo '<div id="music">';
foreach($xml->music as $item) {

	foreach($item->track as $new) {
	echo '<div class="musicInfo">';
		echo 'Artist: '.$new->artist.'<br>';

		echo '</div>';

	}



}
  echo '</div>';
  }
  
  getmusic();?>

Link to comment
https://forums.phpfreaks.com/topic/204302-am-i-missing-something/
Share on other sites

i changed the format now...  no results though.  any ideas?

 

<?php
// load SimpleXML
$tracks = new SimpleXMLElement('http://www.durhamit.ca:8181/1.0/?method=player.GetNowPlayingData', null, true);

echo <<<EOF
<table border='1'>
        <tr>
                <th>Artist</th>
                <th>Title</th>
                <th>Album</th>


        </tr>

EOF;
foreach($tracks as $track) // loop through our tracks
{
        echo <<<EOF
        <tr>
                <td>{$track->artist}</td>
                <td>{$track->title}</td>
                <td>{$track->album}</td>


        </tr>

EOF;
}
echo '</table>';
?>

Try

<?php
{
        echo <<<EOF
        <tr>
                <td>{$track->track->artist}</td>
                <td>{$track->track->title}</td>
                <td>{$track->track->album}</td>


        </tr>

EOF;
}
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.