Jump to content

Archived

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

Michael2k5

pull something from xml

Recommended Posts

Hello! I was wondering if there is a way to easilly pull something from an XML file onto a page. If you could help that would be great! Thanks

here is the code

[code]<?xml version="1.0" standalone="yes" ?>

<SHOUTCASTSERVER>
  <CURRENTLISTENERS>0</CURRENTLISTENERS>
  <PEAKLISTENERS>3</PEAKLISTENERS>
  <MAXLISTENERS>32</MAXLISTENERS>
  <REPORTEDLISTENERS>0</REPORTEDLISTENERS>
  <AVERAGETIME>547</AVERAGETIME>
  <SERVERGENRE />
  <SERVERURL>http://www.skynetx.com/radio/listen.php?dj=</SERVERURL>
  <SERVERTITLE>SkyNetX Radio</SERVERTITLE>
  <SONGTITLE>Rammstein - Laichzeit</SONGTITLE>
  <SONGURL />
  <IRC>#shoutcast</IRC>
  <ICQ>0</ICQ>
  <AIM>N/A</AIM>
  <WEBHITS>3501</WEBHITS>
  <STREAMHITS>141</STREAMHITS>
  <STREAMSTATUS>1</STREAMSTATUS>
  <BITRATE>96</BITRATE>
  <CONTENT>audio/mpeg</CONTENT>
  <VERSION>1.9.5</VERSION>
<WEBDATA>
  <INDEX>12</INDEX>
  <LISTEN>0</LISTEN>
  <PALM7>0</PALM7>
  <LOGIN>0</LOGIN>
  <LOGINFAIL>5</LOGINFAIL>
  <PLAYED>0</PLAYED>
  <COOKIE>0</COOKIE>
  <ADMIN>30</ADMIN>
  <UPDINFO>1027</UPDINFO>
  <KICKSRC>1</KICKSRC>
  <KICKDST>3</KICKDST>
  <UNBANDST>1</UNBANDST>
  <BANDST>1</BANDST>
  <VIEWBAN>2</VIEWBAN>
  <UNRIPDST>0</UNRIPDST>
  <RIPDST>3</RIPDST>
  <VIEWRIP>3</VIEWRIP>
  <VIEWXML>2408</VIEWXML>
  <VIEWLOG>1</VIEWLOG>
  <INVALID>4</INVALID>
  </WEBDATA>
  <LISTENERS />
<SONGHISTORY>
<SONG>
  <PLAYEDAT>1145390097</PLAYEDAT>
  <TITLE>Rammstein - Laichzeit</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145385323</PLAYEDAT>
  <TITLE>Rob Zombie - The Scorpion Sleeps</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145385096</PLAYEDAT>
  <TITLE>Rob Zombie - American Witch</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384869</PLAYEDAT>
  <TITLE>Rob Zombie - 17 Year Locust</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145384656</PLAYEDAT>
  <TITLE>Rob Zombie - Ride</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384649</PLAYEDAT>
  <TITLE>Rob Zombie - 100 Ways</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384467</PLAYEDAT>
  <TITLE>Rob Zombie - Foxy Foxy</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145322513</PLAYEDAT>
  <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145322311</PLAYEDAT>
  <TITLE>Rob Zombie - American Witch</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145322062</PLAYEDAT>
  <TITLE>Rob Zombie - Let It All Bleed Out</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145321619</PLAYEDAT>
  <TITLE>Rob Zombie - The Devil's Rejects</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145321411</PLAYEDAT>
  <TITLE>Rob Zombie - Foxy, Foxy</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145314816</PLAYEDAT>
  <TITLE>System Of A Down - Forest</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145314537</PLAYEDAT>
  <TITLE>System Of A Down - Holy Mountains</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145301373</PLAYEDAT>
  <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE>
  </SONG>

  </SONGHISTORY>
  </SHOUTCASTSERVER>[/code]

yea so i want to easilly pull off parts of this, ex: <PEAKLISTENERS> that would be cool.

Share this post


Link to post
Share on other sites
[!--quoteo(post=367315:date=Apr 21 2006, 02:05 PM:name=Michael2k5)--][div class=\'quotetop\']QUOTE(Michael2k5 @ Apr 21 2006, 02:05 PM) [snapback]367315[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hello! I was wondering if there is a way to easilly pull something from an XML file onto a page. If you could help that would be great! Thanks

here is the code

[code]<?xml version="1.0" standalone="yes" ?>

<SHOUTCASTSERVER>
  <CURRENTLISTENERS>0</CURRENTLISTENERS>
  <PEAKLISTENERS>3</PEAKLISTENERS>
  <MAXLISTENERS>32</MAXLISTENERS>
  <REPORTEDLISTENERS>0</REPORTEDLISTENERS>
  <AVERAGETIME>547</AVERAGETIME>
  <SERVERGENRE />
  <SERVERURL>http://www.skynetx.com/radio/listen.php?dj=</SERVERURL>
  <SERVERTITLE>SkyNetX Radio</SERVERTITLE>
  <SONGTITLE>Rammstein - Laichzeit</SONGTITLE>
  <SONGURL />
  <IRC>#shoutcast</IRC>
  <ICQ>0</ICQ>
  <AIM>N/A</AIM>
  <WEBHITS>3501</WEBHITS>
  <STREAMHITS>141</STREAMHITS>
  <STREAMSTATUS>1</STREAMSTATUS>
  <BITRATE>96</BITRATE>
  <CONTENT>audio/mpeg</CONTENT>
  <VERSION>1.9.5</VERSION>
<WEBDATA>
  <INDEX>12</INDEX>
  <LISTEN>0</LISTEN>
  <PALM7>0</PALM7>
  <LOGIN>0</LOGIN>
  <LOGINFAIL>5</LOGINFAIL>
  <PLAYED>0</PLAYED>
  <COOKIE>0</COOKIE>
  <ADMIN>30</ADMIN>
  <UPDINFO>1027</UPDINFO>
  <KICKSRC>1</KICKSRC>
  <KICKDST>3</KICKDST>
  <UNBANDST>1</UNBANDST>
  <BANDST>1</BANDST>
  <VIEWBAN>2</VIEWBAN>
  <UNRIPDST>0</UNRIPDST>
  <RIPDST>3</RIPDST>
  <VIEWRIP>3</VIEWRIP>
  <VIEWXML>2408</VIEWXML>
  <VIEWLOG>1</VIEWLOG>
  <INVALID>4</INVALID>
  </WEBDATA>
  <LISTENERS />
<SONGHISTORY>
<SONG>
  <PLAYEDAT>1145390097</PLAYEDAT>
  <TITLE>Rammstein - Laichzeit</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145385323</PLAYEDAT>
  <TITLE>Rob Zombie - The Scorpion Sleeps</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145385096</PLAYEDAT>
  <TITLE>Rob Zombie - American Witch</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384869</PLAYEDAT>
  <TITLE>Rob Zombie - 17 Year Locust</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145384656</PLAYEDAT>
  <TITLE>Rob Zombie - Ride</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384649</PLAYEDAT>
  <TITLE>Rob Zombie - 100 Ways</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145384467</PLAYEDAT>
  <TITLE>Rob Zombie - Foxy Foxy</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145322513</PLAYEDAT>
  <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145322311</PLAYEDAT>
  <TITLE>Rob Zombie - American Witch</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145322062</PLAYEDAT>
  <TITLE>Rob Zombie - Let It All Bleed Out</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145321619</PLAYEDAT>
  <TITLE>Rob Zombie - The Devil's Rejects</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145321411</PLAYEDAT>
  <TITLE>Rob Zombie - Foxy, Foxy</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145314816</PLAYEDAT>
  <TITLE>System Of A Down - Forest</TITLE>
  </SONG>
<SONG>
  <PLAYEDAT>1145314537</PLAYEDAT>
  <TITLE>System Of A Down - Holy Mountains</TITLE>
  </SONG>

<SONG>
  <PLAYEDAT>1145301373</PLAYEDAT>
  <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE>
  </SONG>

  </SONGHISTORY>
  </SHOUTCASTSERVER>[/code]

yea so i want to easilly pull off parts of this, ex: <PEAKLISTENERS> that would be cool.
[/quote]


How to do this, and the relative ease with which it can be done is dependent on the version of php you have. If you have php5 then this should help you. [a href=\"http://us2.php.net/manual/en/ref.dom.php\" target=\"_blank\"]http://us2.php.net/manual/en/ref.dom.php[/a]

PHP is a great tool for these types of things, and is well suited to webservices.

Share this post


Link to post
Share on other sites

×

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.