Old 31st July 2003, 11:01   #1
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
PHP based XML parser

I picked up this code from http://www.radiotoolbox.com
But I dont know what else I need to make it work as I cant see where I would put the server info so it can collect the needed info. I've searched on the forums. But never seen a topic thats shown this script being configured. If I'm missin something plz let me know.

PHP Code:
<?php
include("includes.php");
header("Content-Type: image/png");
$im imagecreatefrompng("songband1.png");

if (
$im)
{
ImageString($im,  1,  17,  4,  "Playing: ".$current_song,  2);
ImageString($im,  1,  17,  17,  "There are ".$listeners,  2);

ImagePNG($im);
}
?>
The one thing that I dont understand is where is includes.php
I do know that this code is off the radio tool box appz.
But there will be no point in me installing this on my PC as I dont host the server locally. So I'm jus trying to see this Parser can be configured to work without having the Radio Tool box installed on my PC.

Let me know please.

Brgs

Last edited by Swiftie; 31st July 2003 at 11:40.
Swiftie is offline   Reply With Quote
Old 31st July 2003, 13:18   #2
DJHotIce
Forum Loser
(Forum King)
 
DJHotIce's Avatar
 
Join Date: Jan 2003
Location: That place I can't remember the name.
Posts: 4,617
Send a message via AIM to DJHotIce Send a message via Yahoo to DJHotIce
hmmmm thats a thing I don't understand either...
try this
go to http://totalrequests.nboxmusic.com/ and click on the goodies there is a winzip file samed Chrystal Stats, that should help its I think a little easier to work

-DJHotIce
Bounce Multimedia - Professional Web Design
DJHotIce is offline   Reply With Quote
Old 31st July 2003, 16:01   #3
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108


If you can't install Radio ToolBox, why do you think RTB modules will work stand-alone?

Please see this thread.

FesterHead is offline   Reply With Quote
Old 31st July 2003, 18:08   #4
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Reason why I'm thinkin I cant install RTB is cause the Shoutcast Server is hosted on Streamguys & I thought RTB will only work if u have you Server locally. So if I was to install RTB. Wont that mean my PC will need 2 be on if I want the Parser to work?

Thanx DJHotice. Will look into that.


Brgs
Swiftie is offline   Reply With Quote
Old 31st July 2003, 18:38   #5
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
I believe all you need to do is tell RTB your DNAS ip, port and password.

FesterHead is offline   Reply With Quote
Old 1st August 2003, 01:38   #6
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Quote:
Originally posted by festerhead
I believe all you need to do is tell RTB your DNAS ip, port and password.
But does the person who has installed RTB need to have their PC on & connected to the net then? Otherwise the parser wont update will it?

This is the reason why I was interested in a stand alone code that I can jus bang on a Webhost & let the script just catch the info from the DNSA & the rest is understandable.


Brgs
Swiftie is offline   Reply With Quote
Old 1st August 2003, 03:26   #7
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,942
yea Radio Toolbox needs to run in a windows environment that is connected to the internet, the server does not have to be local.

A good place to place it is with the source Winamp.

If this is not an option then using the other PHP based parsers will be neccessary.
Just remember to use caching when you use these as they will quickly hammer you shoutcast server to death if you have a large surge of traffic at your website.

By the way, the includes.php comes from the catcher.php scripts included with the installation of Radio Toolbox, this includes.php holds all the data that radio toolbox has on your servers. You can then simply do this include("inclues.php"); on multiple php pages to include stats about your server on every page of your website. Including this module.
Jay is offline   Reply With Quote
Old 4th August 2003, 18:00   #8
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Ok. Finally I've managed to get something that I liked.

Example ->>


Can some please suggest a way I can make the TEXT bigger.
As its a lil hard to read for other people at times.

Brgs
Swiftie is offline   Reply With Quote
Old 4th August 2003, 18:53   #9
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Chack out the ImageString and ImageLoadFont functions.

FesterHead is offline   Reply With Quote
Old 4th August 2003, 21:18   #10
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
So I just have to delete these functions from the script?
After doing this then how can I set the Text size to a bigger size.

PHP Code:
// positioning below
    
$px = (imagesx($im)-5*strlen($string1))/2;
    
ImageString($im,1,$px,5,$string1,$text_color1);
//             (image,font (from 1 to 5),starting x position, y position,line of text,color)
    
$px = (imagesx($im)-5*strlen($string2))/2;
    
ImageString($im,1,$px,20,$string2,$text_color2);
    
$px = (imagesx($im)-5*strlen($string3))/2;
    
ImageString($im,1,$px,30,$string3,$text_color2);
    
$px = (imagesx($im)-5*strlen($string4))/2;
    
ImageString($im,1,$px,45,$string4,$text_color1);
    
ImagePng($im); 
If u want the rest of the Coding then you can see it here...

PHP CODING

Thankx to DJRampage
Swiftie is offline   Reply With Quote
Old 4th August 2003, 22:21   #11
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Don't delete the lines.

Use ImageLoadFont to load a new font for your image.
Use the font loaded in ImageString.

FesterHead is offline   Reply With Quote
Old 19th August 2003, 12:17   #12
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Would it be possible that instead of the parser getting the SONG info from the yellow pages. That it collects the Server Description instead??

PHP Code:
$string2$song[0];
$string3$song[1]; 
These are the two strings used to collect the Song Info & its displayed on the parser. But does any one know what strings I can use to show the Shoutcast "Server Description" instead.

Brgs
Swiftie is offline   Reply With Quote
Old 19th August 2003, 16:08   #13
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Do you mean the stream title?

It's available from the DNASs XML as an element named SERVERTITLE.

FesterHead is offline   Reply With Quote
Old 19th August 2003, 22:31   #14
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Quote:
Originally posted by festerhead
Do you mean the stream title?

It's available from the DNASs XML as an element named SERVERTITLE.
yes this is the one.

But how can I implement it to show up on something like this..



instead of the song title.
Swiftie is offline   Reply With Quote
Old 20th August 2003, 11:29   #15
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Any one have any ideas please?

Brgs
Swiftie is offline   Reply With Quote
Old 21st August 2003, 08:41   #16
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Please some one who can be off assistant help me please.

I've tried everything but its not managed to work.

I even tried to change the
PHP Code:
$string1$song[0];
$string2$song[1]; 
to

PHP Code:
$string1$servertitle[0];
$string2$song[1]; 

But all I get is a blank input when the server is on & has a Stream Title.

So any one with ideas please feel free.

Brgs
Swiftie is offline   Reply With Quote
Old 21st August 2003, 15:55   #17
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
What package are you using?

FesterHead is offline   Reply With Quote
Old 21st August 2003, 23:56   #18
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
I'm using this code here. Which started off from DJ Rampage & I've just edited & kept the info I need. But as the dj's that play on my station mix from decks I would like to have the script grab the stream tittle rather than the Song Title as then it will be simple for my Dj's to configure this so that visitors can see what DJ is on at what time. Instead of having to muck about with disabling the auto update & then having to put his name each time he logs onto the server. If this script could just grab the server title then all the DJ would need to do is put his name under Server Description & off he goes.

BTW this is the code I use.


PHP Code:
<?php
// This image you can call immediately from an html file in the image tag
// (i.e. <image src="black.php">)    easy huh?

    
Header("Content-type: image/png");

// Fill in your own server information here:    
    
$host "your.ip.address";
    
$port "your.port";
    
$listenlink 'http://your.ip.address:your.port/listen.pls'//make link to stream
    
    
$fp fsockopen("$host"$port, &$errno, &$errstr30); //open connection
    
if(!$fp) {
        
$success=2;  //se-t if no connection
    
}
    if(
$success!=2){ //if connection
        
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html
        
while(!feof($fp)) {
            
$page .= fgets($fp1000);
        }
        
fclose($fp); //close connection
        
$page ereg_replace(".*<body>"""$page); //extract data
        
$page ereg_replace("</body>.*"","$page); //extract data
        
$numbers explode(",",$page); //extract data
        
$currentlisteners=$numbers[0]; //set variable
        
$connected=$numbers[1]; //set variable

        
if($connected==1//if DSP is connected
            
$wordconnected="yes"//set variable
        
else //if no DSP connection
            
$wordconnected="no"//set variable
        
$peaklisteners=$numbers[2]; //set variable
        
$maxlisteners=$numbers[3]; //set variable
        
$reportedlisteners=$numbers[4]; //set variable
    
}

// Image size can be changed here: (x, y)
    
$im ImageCreate(168,18);
    
// Background color in R(ed)G(reen)B(lue) below
    
$background_color ImageColorAllocate($im,0,0,0);
    
// text colors also in RGB
    
$text_color1 ImageColorAllocate($im,0,255,0);
    
$text_color2 ImageColorAllocate($im,0,255,0);
    
    if(
$success!=&& $connected==1){

// song information is splitted in artist - title: 
// This requires consistent artist & title format (no ' - ' in title/artist)
// else you can use $numbers[6] as current song info below
        
$song=explode(" - ",$numbers[6]);
        
// strings can of course be replaced with your own blah
        
$string1$song[0];
        
$string2$song[1];
    }
    else {
        
$string1"Rush FM Is Currently OFF AIR";
    }
    
// positioning below
    
$px = (imagesx($im)-5*strlen($string1))/2;
    
ImageString($im,1,$px,5,$string1,$text_color1);
//             (image,font (from 1 to 5),starting x position, y position,line of text,color)
    
$px = (imagesx($im)-5*strlen($string2))/2;
    
ImageString($im,1,$px,20,$string2,$text_color2);
    
$px = (imagesx($im)-5*strlen($string3))/2;
    
ImageString($im,1,$px,30,$string3,$text_color2);
    
$px = (imagesx($im)-5*strlen($string4))/2;
    
ImageString($im,1,$px,45,$string4,$text_color1);
    
ImagePng($im);
                            
// In response to KXRM's reaction:
                            // if you want to cache the picture, you should place this script in 
                            // your internetpage, remove line 5 (Header-call)
                            // and use ImagePng($im, "filename.png");
                            // NB: filename.png must have the right permission settings 
                            // (CHMOD 777 does it)
                            // Then you can place filename.png in the same html-file.
    
ImageDestroy($im);
?>

Brgs
Swiftie is offline   Reply With Quote
Old 23rd August 2003, 12:24   #19
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Still tryin to get this code to work

Can any one please shed some light to my problem


Brgs
Swiftie is offline   Reply With Quote
Old 28th August 2003, 11:43   #20
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Just bumping this for any one that know's what I may need to tweak to the code to show the "SERVER TITTLE" instead of the Song Tittle.


Brgs
Swiftie is offline   Reply With Quote
Old 28th August 2003, 16:11   #21
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
7.html does not have server title.

Take a look at it.

http://DNAS-IP:DNAS:PORTBASE/7.html

FesterHead is offline   Reply With Quote
Old 29th August 2003, 23:53   #22
Swiftie
Junior Member
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 49
Yeah I see sense now.

Is there any other code or anything else that I can use that can call the server tittle at all?


Brgs
Swiftie is offline   Reply With Quote
Old 30th August 2003, 00:42   #23
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Use the DNASs XML statistics

FesterHead is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump