Note that there are some explanatory texts on larger screens.

plurals
  1. PORepeating and Changing php values for my Music Player
    primarykey
    data
    text
    <p>I would like to know how i can change or repeat certain elements in php. Right now i am using a script to fetch what song is playing from a shout-cast info page.</p> <p>And in JQuery i have a player with a playlist that switches stream.</p> <p>Now the only thing it does right now is just switch to the stream and not display anything. So how would i go about on calling an php part inside jQuery? <br><br><br> Gosh, i really hope im being clear enough in my explanation.</p> <p><br></p> <p>For those who are able to help me<br> <br><br><strong>What parts of my code do you want me to display?</strong> <br><br><br> i wil then go ahead and paste that for you Right away! :) <br><br><br> Greets,</p> <p>Kus.</p> <p>Code for Arjan: JQUery</p> <pre><code>$(document).ready(function(){ var myPlaylist = new jPlayerPlaylist({ jPlayer: "#jquery_jplayer", cssSelectorAncestor: "#jp_container" }, [ { title: "test", mp3: "http://178.156.201.212:8018/;stream/1", &lt;?php $host = "178.156.201.212"; // ip or url of shoutcast server $port = "8018"; ?&gt; }, { title: "test2", mp3: "http://stream1.slowradio.com/;stream/1", &lt;?php $host = "http://stream1.slowradio.com"; // ip or url of shoutcast server $port = "8008"; ?&gt; }, { title: "test3", mp3: "http://108.61.73.119:8022/;stream/1", &lt;?php $host = "108.61.73.119"; // ip or url of shoutcast server $port = "8022"; ?&gt; }, ], { swfPath: "js", supplied: "oga, mp3", wmode: "window" }); $("#jquery_jplayer").bind($.jPlayer.event.play, function(event) { //$('#fetch').html(jPlayerPlaylist.playlist[jPlayerPlaylist.current].title); $('#fetch').empty(); $('#fetch').append(myPlaylist.playlist[myPlaylist.current].title); }); }); </code></pre> <p>PHP</p> <pre><code>&lt;?php $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(".*&lt;body&gt;", "", $data); $data = ereg_replace("&lt;/body&gt;.*", ",", $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]); ?&gt; &lt;?php if($status == 1) { echo $artist. " - " .$title; } else { print 'document.getElementById("title").innerHTML = "Offline";'; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload