Jump to content

need to show acording pic from xml file


duck

Recommended Posts

Hello 
ime completly new to posting on this forum and to php so i hope ime correct here smile.png

i got this simple php to get the required info from a xml file but now i would like it to show a pic of the acording dj (servertitle.)

<?php
$xml=simplexml_load_file("/shout.xml");
echo $xml->SERVERTITLE . "<br>";

?>
so what i actualy need is sombody to help me on getting the if (dj_name) then (show pic)

Link to comment
Share on other sites

<?xml version="1.0" standalone="yes" ?><!DOCTYPE SHOUTCASTSERVER [<!ELEMENT SHOUTCASTSERVER (CURRENTLISTENERS,PEAKLISTENERS,MAXLISTENERS,REPORTEDLISTENERS,AVERAGETIME,SERVERGENRE,SERVERURL,SERVERTITLE,SONGTITLE,SONGURL,IRC,ICQ,AIM,WEBHITS,STREAMHITS,STREAMSTATUS,BITRATE,CONTENT,VERSION,WEBDATA,LISTENERS,SONGHISTORY)><!ELEMENT CURRENTLISTENERS (#PCDATA)><!ELEMENT PEAKLISTENERS (#PCDATA)><!ELEMENT MAXLISTENERS (#PCDATA)><!ELEMENT REPORTEDLISTENERS (#PCDATA)><!ELEMENT AVERAGETIME (#PCDATA)><!ELEMENT SERVERGENRE (#PCDATA)><!ELEMENT SERVERURL (#PCDATA)><!ELEMENT SERVERTITLE (#PCDATA)><!ELEMENT SONGTITLE (#PCDATA)><!ELEMENT SONGURL (#PCDATA)><!ELEMENT IRC (#PCDATA)><!ELEMENT ICQ (#PCDATA)><!ELEMENT AIM (#PCDATA)><!ELEMENT WEBHITS (#PCDATA)><!ELEMENT STREAMHITS (#PCDATA)><!ELEMENT STREAMSTATUS (#PCDATA)><!ELEMENT BITRATE (#PCDATA)><!ELEMENT CONTENT (#PCDATA)><!ELEMENT VERSION (#PCDATA)><!ELEMENT WEBDATA (INDEX,LISTEN,PALM7,LOGIN,LOGINFAIL,PLAYED,COOKIE,ADMIN,UPDINFO,KICKSRC,KICKDST,UNBANDST,BANDST,VIEWBAN,UNRIPDST,RIPDST,VIEWRIP,VIEWXML,VIEWLOG,INVALID)><!ELEMENT INDEX (#PCDATA)><!ELEMENT LISTEN (#PCDATA)><!ELEMENT PALM7 (#PCDATA)><!ELEMENT LOGIN (#PCDATA)><!ELEMENT LOGINFAIL (#PCDATA)><!ELEMENT PLAYED (#PCDATA)><!ELEMENT COOKIE (#PCDATA)><!ELEMENT ADMIN (#PCDATA)><!ELEMENT UPDINFO (#PCDATA)><!ELEMENT KICKSRC (#PCDATA)><!ELEMENT KICKDST (#PCDATA)><!ELEMENT UNBANDST (#PCDATA)><!ELEMENT BANDST (#PCDATA)><!ELEMENT VIEWBAN (#PCDATA)><!ELEMENT UNRIPDST (#PCDATA)><!ELEMENT RIPDST (#PCDATA)><!ELEMENT VIEWRIP (#PCDATA)><!ELEMENT VIEWXML (#PCDATA)><!ELEMENT VIEWLOG (#PCDATA)><!ELEMENT INVALID (#PCDATA)><!ELEMENT LISTENERS (LISTENER*)><!ELEMENT LISTENER (HOSTNAME,USERAGENT,UNDERRUNS,CONNECTTIME, POINTER, UID)><!ELEMENT HOSTNAME (#PCDATA)><!ELEMENT USERAGENT (#PCDATA)><!ELEMENT UNDERRUNS (#PCDATA)><!ELEMENT CONNECTTIME (#PCDATA)><!ELEMENT POINTER (#PCDATA)><!ELEMENT UID (#PCDATA)><!ELEMENT SONGHISTORY (SONG*)><!ELEMENT SONG (PLAYEDAT, TITLE)><!ELEMENT PLAYEDAT (#PCDATA)><!ELEMENT TITLE (#PCDATA)>]><SHOUTCASTSERVER><CURRENTLISTENERS>5</CURRENTLISTENERS><PEAKLISTENERS>30</PEAKLISTENERS><MAXLISTENERS>250</MAXLISTENERS><REPORTEDLISTENERS>5</REPORTEDLISTENERS><AVERAGETIME>582</AVERAGETIME><SERVERGENRE>Various</SERVERGENRE><SERVERURL>http://www.RocketNetRadio.com</SERVERURL><SERVERTITLE>DJ Misty</SERVERTITLE><SONGTITLE>Martina McBride - I Just Call You Mine</SONGTITLE><SONGURL>http://www.RocketNetRadio.com</SONGURL><IRC>#audiorealm</IRC><ICQ>NA</ICQ><AIM>NA</AIM><WEBHITS>577455</WEBHITS><STREAMHITS>20137</STREAMHITS><STREAMSTATUS>1</STREAMSTATUS><BITRATE>64</BITRATE><CONTENT>audio/mpeg</CONTENT><VERSION>1.9.8</VERSION><WEBDATA><INDEX>5544</INDEX><LISTEN>1</LISTEN><PALM7>380240</PALM7><LOGIN>0</LOGIN><LOGINFAIL>3</LOGINFAIL><PLAYED>27154</PLAYED><COOKIE>0</COOKIE><ADMIN>1</ADMIN><UPDINFO>11029</UPDINFO><KICKSRC>126</KICKSRC><KICKDST>0</KICKDST><UNBANDST>0</UNBANDST><BANDST>0</BANDST><VIEWBAN>0</VIEWBAN><UNRIPDST>0</UNRIPDST><RIPDST>0</RIPDST><VIEWRIP>0</VIEWRIP><VIEWXML>150060</VIEWXML><VIEWLOG>0</VIEWLOG><INVALID>3297</INVALID></WEBDATA><LISTENERS><LISTENER><HOSTNAME>65.95.50.174</HOSTNAME><USERAGENT>MPEG OVERRIDE</USERAGENT><UNDERRUNS>0</UNDERRUNS><CONNECTTIME>1479</CONNECTTIME><POINTER>3</POINTER><UID>20115</UID></LISTENER><LISTENER><HOSTNAME>70.251.11.206</HOSTNAME><USERAGENT>MPEG OVERRIDE</USERAGENT><UNDERRUNS>0</UNDERRUNS><CONNECTTIME>1253</CONNECTTIME><POINTER>1</POINTER><UID>20127</UID></LISTENER><LISTENER><HOSTNAME>68.44.91.114</HOSTNAME><USERAGENT>MPEG OVERRIDE</USERAGENT><UNDERRUNS>0</UNDERRUNS><CONNECTTIME>1175</CONNECTTIME><POINTER>0</POINTER><UID>20133</UID></LISTENER><LISTENER><HOSTNAME>85.218.136.155</HOSTNAME><USERAGENT>MPEG OVERRIDE</USERAGENT><UNDERRUNS>0</UNDERRUNS><CONNECTTIME>123</CONNECTTIME><POINTER>4</POINTER><UID>20135</UID></LISTENER><LISTENER><HOSTNAME>216.115.153.38</HOSTNAME><USERAGENT>MPEG OVERRIDE</USERAGENT><UNDERRUNS>0</UNDERRUNS><CONNECTTIME>85</CONNECTTIME><POINTER>5</POINTER><UID>20136</UID></LISTENER></LISTENERS><SONGHISTORY><SONG><PLAYEDAT>1377695012</PLAYEDAT><TITLE>Martina McBride - I Just Call You Mine</TITLE></SONG><SONG><PLAYEDAT>1377694874</PLAYEDAT><TITLE>Manfred Mann - Doo Wah Diddy</TITLE></SONG><SONG><PLAYEDAT>1377694645</PLAYEDAT><TITLE>LoneStar - Amazed</TITLE></SONG><SONG><PLAYEDAT>1377694391</PLAYEDAT><TITLE>Texas Renegade - Barditch</TITLE></SONG><SONG><PLAYEDAT>1377694142</PLAYEDAT><TITLE>Josh Turner - Long Black Train</TITLE></SONG><SONG><PLAYEDAT>1377693888</PLAYEDAT><TITLE>Brad Paisley & Allison Krauss - Whiskey Lullaby</TITLE></SONG><SONG><PLAYEDAT>1377693753</PLAYEDAT><TITLE>Richie Valens - Donna</TITLE></SONG><SONG><PLAYEDAT>1377693380</PLAYEDAT><TITLE>Scorpions - Still Loving You</TITLE></SONG><SONG><PLAYEDAT>1377693151</PLAYEDAT><TITLE>John Mayer - Gravity</TITLE></SONG><SONG><PLAYEDAT>1377692925</PLAYEDAT><TITLE>Katrina And The Waves - Walking On Sunshine</TITLE></SONG></SONGHISTORY></SHOUTCASTSERVER>

Link to comment
Share on other sites

first of all ty verry much for your help , but like i mentiond in topic ime completly new to php , 

ime comletly clueless what it is you mean , i did put that in a php and did run it and it cameup blank .

however the source behind it was this .

 

<!-- Hosting24 Analytics Code -->   <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>   <!-- End Of Analytics Code -->
Link to comment
Share on other sites

actualy i found a php script wich is suposed  to do exactly what i want , but for some reason it dont seem to connect to get the shoutcast server .

maybe it would save you time and effort if i show you that instead .

<title>Server info</title>

<?
//konfiguravimas
$scdef = "Server temporary not working.Try it latter."; // servers message if its offline.
$scip = "95.154.254.153"; // ip or url address (Just without any html://)
$scport = "14717"; // server port
$scpass = "testradio"; // Password
$maxusers = "50"; //How much liosteners can tune in same tme
//End configuration
error_reporting(0);
$scsuccs = NULL;
$page = NULL;
include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo'<center>'.$scdef.'</center>';
}
if ($scsuccs != 1) {
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "AIM","ICQ");
$y=0;
while (isset($loop[$y])) {
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if (($loop[$y] == "SERVERGENRE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "SONGTITLE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "AIM")|| ($loop[$y] == "ICQ"))
$$scphp = urldecode($$scphp);

// uncomment the next line to see all variables
// echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while (isset($songatime[$r])) {
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<ICQ>", "", $page);
$dj[$t] = ereg_replace("</ICQ>.*", "", $pageed);
$r++;
}
$daina = str_replace('_',' ',substr ($song[0],0,90));
//end song info


fclose($scfp);
}


//Eterio Foto
if($streamstatus == "1"){
switch ($icq) {
case 'No show': $icq = "No show"; break;
default: $icqlogo = "No show";
}
$_SESSION['djus'] = $icq;



echo '
<p align="center">
<img src="../team/foto/'.$servertitle.'.jpg" alt="team"/>';


}

echo'</p>
';

echo '
<p align="left">';
echo '
<b>Dj on air:</b> '.$servertitle.'<br/>
<b>Song on air:</b><marquee behavior="scroll" direction="left" scrollamount="2" scrolldelay="10">'.$song[0].'</marquee>
</p>';


 if($streamstatus == "0") {
echo'Sorry server is down';
}
?>

this server is up and running but is just a free test server so i dont mind having the pasw init :)

Link to comment
Share on other sites

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.