Bluepearl Design
Go Back   Bluepearl Design > Misc > Tutorials > PHP & MySQL

[PHP] Putting a Internet Radio Status in Your sig.

PHP 4 & 5 Hypertext Preprocessor
MySQL multi-user, SQL (Structured Query Language) Database Management System

    

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 07-31-2005, 08:30 AM   #1 (permalink)
 
SpawnDemon's Avatar
 
Title: Bluepearl Veteran
Join Date: Jul 2005
Location: Philadelphia, Pennsylvania - Home Base
Posts: 727
Rep Power: 4 SpawnDemon is on a distinguished road
Send a message via MSN to SpawnDemon Send a message via Skype™ to SpawnDemon
[PHP] Putting a Internet Radio Status in Your sig.

PHP Code:
<?php
// Ruff Dawg's 'Now Playing Sig w/ Background v. 1.5 May 7, 2004
// Special thanks to the originator, DJ Rampage
// Modded specifically for Bluepearl by Spawndemon

// This image you can call immediately from an html file in the image tag
// (i.e. <img src="sic_pic.png">)    easy huh?

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

////////////////////////////////////////////////////////////////////////////////////////

/
//////////////////////////////*Configurables*//////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////

/////////////////////*Background Picture File*////////////////////////

/* Replace "sic_pic.png" with your own
picture file (must be a .png) */

    
$im =

imagecreatefrompng("sig.png");

/////////////////////////////*Host Information*/////////////////////////////

    
$host "Your radio host url"// No 'http://' in the host
    
$port "Your radio host port";

//////////////////////////////////*Text Colors*////////////////////////////////

// text colors are in RGB

    
$text_color1 ImageColorAllocate($im,145,150,161);
    
$text_color2 ImageColorAllocate($im,14,15,16);

////////////////////////////////////*Text Size*/////////////////////////////////

    
$text_size "4";
    
$text_size1 "3";

//////////////////////////////*Text Alignment*/////////////////////////////

//X alignment

    
$x1 "20";
    
$x2 "40";
    
$x3 "490";

//Y alignment

    
$y1 "175";
    
$y2 "25";
    
$y3 "25";

///////////////////////////*Offline Message*///////////////////////////////

    
$offline1 "MPC Radio Is Currently Offline";
    
$offline2 "Please Check Later";
    
$offline3 "";


////////////////////////////////////////////////////////////////////////////////////////

//////////
/////*DON'T TOUCH THE CODE BELOW UNLESS//////////
///YOU KNOW EXACTALLY WHAT YOU ARE DOING*//
////////////////////////////////////////////////////////////////////////////////////////

///////

    
$fp fsockopen("$host"$port, &$errno, &$errstr30);
    if(!
$fp) {
        
$success=2;
    }
    if(
$success!=2){ //if connection
        
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla

Compatible)\r\n\r\n"
);
        while(!
feof($fp)) {
            
$page .= fgets($fp1000);
        }
        
fclose($fp);
        
$page ereg_replace(".*<body>"""$page); //extract data
        
$page ereg_replace("</body>.*"","$page); //extract data
        
$numbers explode(",",$page);
        
$currentlisteners=$numbers[0];
        
$connected=$numbers[1];
        if(
$connected==1)
            
$wordconnected="yes";
        else
            
$wordconnected="no";
        
$peaklisteners=$numbers[2];
        
$maxlisteners=$numbers[3];
        
$reportedlisteners=$numbers[4];
    }
     
    if(
$success!=&& $connected==1){
         
    
$song=explode("<>" ,$numbers[6]);

        
$string1$song[0];
        
$string2$song[1];
        
$string3"$currentlisteners/$maxlisteners";
    }

    else {
        
$string1$offline1;
        
$string2$offline2;
        
$string3$offline3;
    }

    
$px = (imagesx($im)-5*strlen($string1))/2;
    
ImageString($im,$text_size,$x1,$y1,$string1,$text_  color1);
    
$px = (imagesx($im)-5*strlen($string2))/2;
    
ImageString($im,$text_size1,$x2,$y2,$string2,$text  _color2);
    
$px = (imagesx($im)-5*strlen($string3))/2;
    
ImageString($im,$text_size1,$x3,$y3,$string3,$text  _color2);

    
ImagePng($im);
    
imagedestroy($im);
?>
And there ye go. Both the PNG and the PHP have to be on the same directory. And both have to be uploaded on a PHP allowed FTP Access.

Well, There ya go!
__________________
What did he say? A new e1studios site? Where can I get some. Click Here!
SpawnDemon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-31-2005, 11:29 AM   #2 (permalink)
 
Sean's Avatar
 
Title: Founder/Admin
Join Date: Jan 2004
Location: Sydney, Australia
Age: 28
Posts: 8,874
Images: 386
Blog Entries: 3
Rep Power: 10 Sean will become famous soon enough
Send a message via MSN to Sean Send a message via Skype™ to Sean
Re: [PHP] Putting a Internet Radio Status in Your sig.

thx for adding

does this work for both Wimamp and Media Player?
Sean is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-31-2005, 01:12 PM   #3 (permalink)
 
SpawnDemon's Avatar
 
Title: Bluepearl Veteran
Join Date: Jul 2005
Location: Philadelphia, Pennsylvania - Home Base
Posts: 727
Rep Power: 4 SpawnDemon is on a distinguished road
Send a message via MSN to SpawnDemon Send a message via Skype™ to SpawnDemon
Re: [PHP] Putting a Internet Radio Status in Your sig.

What do you mean? It only shows the status of a radio. Unless you want it to link to winamp and Media Player than you need to add links to each seperate player.

for Winamp: www.mp3.hostserver.comort
for Media Player: www.wmp.hostserver.comort
for Realplayer: www.ram.hostserver.comort
__________________
What did he say? A new e1studios site? Where can I get some. Click Here!
SpawnDemon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: [PHP] Putting a Internet Radio Status in Your sig.
Thread Thread Starter Forum Replies Last Post
INTERNET RADIO UPDATE! The Day of Silence on June 26th Bluepearl Feeds RSS Feeds 0 06-26-2007 06:18 PM
Best Internet Radio on the Net. Sean Cool Links 13 01-21-2004 02:05 PM


  
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Bluepearl Templates

All times are GMT +11. The time now is 01:05 PM.

 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52