$out['artist'] = isset($_REQUEST['artist']) ? $_REQUEST['artist'] : ''; $out['title'] = isset($_REQUEST['title']) ? $_REQUEST['title'] : ''; $file_out = fopen(__DIR__ . '/current.json'), "w+"); $icecastmetadata = json_encode($out, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); fwrite($file_out, $icecastmetadata); fclose($file_out);
<?php $out['artist'] = isset($_REQUEST['artist']) ? $_REQUEST['artist'] : ''; $out['title'] = isset($_REQUEST['title']) ? $_REQUEST['title'] : ''; $file_out = fopen(__DIR__ . '/current.json'), "w+"); $icecastmetadata = json_encode($out, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); fwrite($file_out, $icecastmetadata); fclose($file_out); ?>
function show_station_title() var timestamp = new Date().getTime(); $.getJSON("current.json?" + timestamp, function(data) { if ((data.artist !== undefined) && (data.title !== undefined)) { $("контейнер").html(data.artist + ' - ' + data.title); } }; setInterval('show_station_title()', 3000);