#!/usr/bin/perl # Script: s_player.cgi (chmod: 755) # This script requires the "CGI.pm" modue & # LWP::Simple module on your server. ####################################### use CGI; $query = new CGI; $cmd = $query->param('cmd'); $url = $query->param('url'); $id = $query->param('id'); if ($cmd eq "Play My Sonic Station") { &play; } elsif ($cmd eq "Play My Sonic Station") { $url = "http://radio.sonicnet.com/playlists/rpmuser.asp?C=LOW&B=$id&X=X&Z=RAM.RPM"; &play; } else { &home; } ###################################### sub home { print "Content-type: text/html\n\n"; print < sonic station player
</body> </html> PJP } sub play { use LWP::Simple; @source = get($url); print "Content-type: audio/x-pn-realaudio\n\n"; open(DAT,">s_player.dat"); flock DAT, 2; print DAT @source; close(DAT); open(DAT,"<s_player.dat"); @play = <DAT>; flock DAT, 8; close(DAT); foreach $i (@play) { chomp($i); ($p,$f) = split(/\?/, $i); if ($p =~ /stops/gi) { print ""; } else { print "$p\n\n"; } } unlink "s_player.dat"; }