Jump to content

Recommended Posts

hello,

 

i was going through a tutorial on how to display xml data on a website.  here is my xml output from my music player:

 

  <?xml version="1.0" encoding="UTF-8" ?> 
- <hmm status="ok">
- <tracks>
- <track>
  <album>Sixteen Stone</album> 
  <bpm>0</bpm> 
  <database-id>4</database-id> 
  <exists>false</exists> 
  <filename>D:\Temp\Music\h07 - Machinehead.mp3</filename> 
  <index>0</index> 
  <length>256</length> 
  <mood /> 
  <popularity>0</popularity> 
  <recording-year>1994</recording-year> 
  <release-year>1994</release-year> 
  <situation /> 
  <publisher /> 
  <format>MPEG Audio 128 kbps</format> 
  <is-subtrack>false</is-subtrack> 
  <is-favourite>false</is-favourite> 
  <release-type>0</release-type> 
  <subtrack-index>-1</subtrack-index> 
  <artist>Bush</artist> 
  <genre>Rock</genre> 
  <rating>0</rating> 
  <title>Machinehead</title> 
  </track>
  </tracks>
  </hmm>

 

here is the code that i thought would display the artists name:

 

<xml ID="music" src="http://localhost:8181/1.0/?method=player.getNowPlayingData"></xml>		
Artist:
<span datasrc="music" datafld="artist"></span>

 

 

 

should this work?

Link to comment
https://forums.phpfreaks.com/topic/204234-should-this-work-or-am-i-stupid/
Share on other sites

Good song.  I am willing to bet that the media player isn't attached to a publicly facing server.  I'd bet you are using localhost for this. 

 

Throw

http://localhost:8181/1.0/?method=player.getNowPlayingData

into your browser window to make sure you get the xml out.

 

Then fix your problem and replace:

 

<span datasrc="music" datafld="artist"></span>

 

with:

 

<span datasrc="#music" datafld="artist"></span>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.