Ok i am remaking this question since i think i made it a bit too long :)
My research was from websites where i learned how to make functions and timers.
I wanna ofcourse repeat the php part with a timer but i think i know how too.
First i think its important i atleast get the value to change when i change stream.
This is my JQuery Code that grabs the title variable from @2
@1
$("#jquery_jplayer").bind($.jPlayer.event.play, function(event) {
$('#title').empty();
$('#title').append(myPlaylist.playlist[myPlaylist.current].title);
@2
var myPlaylist = new jPlayerPlaylist({jPlayer: "#jquery_jplayer",
cssSelectorAncestor: "#jp_container"
}, [{
title: "test", // This is grabbed
mp3: "http://x.x.x.x:xxxx/",
streaminfo: "x.x.x.x","xxxx", // Ip and port Seperate
},
{
title: "test2", // This is grabbed
mp3: "http://x.x.x.x:xxxx/",
streaminfo: "x.x.x.x","xxxx", // Ip and port Seperate
},
I would like to have this code:
$('#title').append(myPlaylist.playlist[myPlaylist.current].title);
Fetch the ip and port. but then in PHP, Because i have the folowing php code that grabs the song title from a shoutcast stream URL.
The php code is as follows:
<?php
function myTest($host,$port)
{
//$host = "178.156.201.212"; // ip or url of shoutcast server
//$port = "8000"; // port of shoutcast server
$fp = @fsockopen("$host", $port, $errno, $errstr, 30);
if($fp)
{
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: GET SEVEN (Mozilla Compatible)\r\n\r\n");
while(!feof($fp))
{
$data .= fgets($fp, 1000);
}
fclose($fp);
$data = ereg_replace(".*<body>", "", $data);
$data = ereg_replace("</body>.*", ",", $data);
$data_array = explode(",",$data);
$listeners = $data_array[0];
$status = $data_array[1];
$peak_listeners = $data_array[2];
$maximum_listeners = $data_array[3];
$unique_listeners = $data_array[4];
$bitrate = $data_array[5];
$track = $data_array[6];
}
$title = chop($track);
$select = explode(" - ",$title);
$artist = chop($select[0]);
$title = chop($select[1]);
}
?>
I hope i am being clear on displaying my question :)