[php]<?php
$sc_url_ip = “xx.xxx.xx.xxx”;
$sc_url_port = “8063”;
function getNowPlaying($sc_url_ip,$sc_url_port)
{
$open = fsockopen($sc_url_ip,$sc_url_port,$errno,$errstr,’.5’);
if ($open) {
fputs($open,“GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n”);
stream_set_timeout($open,‘1’);
$read = fread($open,200);
$text = explode(",",$read);
if($text[6] == ‘’ || $text[6] == ‘’){ $msg = ’ live stream '; } else { $msg = $text[6]; }
$text = $msg;
} else { return false; }
fclose($open);
return $text;
}
$csong = getNowPlaying($sc_url_ip,$sc_url_port);
print ‘’.$csong.’’;
print “
”;
if ($csong == “Song Title Here”)
print “True”;
else
print “False”;
?>
[/php]
Basically pulls the song title from a shoutcast server. Trying to use this information to tell what DJ is playing (song wont change based on what DJ is playing) so… if it matches the song playing, then a certain DJ is playing, hence the if statement. But, this code always returns the false value? I am still not that good with php but I do believe it has to do with the way my $csong variable is set? Any help would be great! Thanks a lot! The code works, just not the if statement with the $csong variable.