Skip to content
View in the app

A better way to browse. Learn more.

Komuniti @PuTeRA

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Shoutcast: Display Data Dari Server

Featured Replies

Salam semua,

ada sesapa kat sini pernah setup Shoutcast Server?

aku baru je setup satu shoutcast server untuk radio streaming, page untuk handle player radio duduk berasingan (shared server) dan server shoutcast duduk dalam VPS server. Radio dah jalan 100%. Cuma sekarang ni aku ada masalah nak query info shoutcast server dari shared server.

Dah cuba banyak script "Now Playing" untuk display data kat webpage, dipendekkan cerita banyak error sangkut dekat [b]fsockopen[/b]

[CODE]Warning: fsockopen() [function.fsockopen]: unable to connect to xx.xx.xx.xx:8000 in /home/xxx/public_html/nowplaying.php on line 6[/CODE]

contoh script yg dah guna: [url="http://www.szone.us/f6/standalone-php-shoutcast-status-5/"]http://www.szone.us/...tcast-status-5/[/url]

Bila aku test kat localhost suma OK. So aku suspect hosting provider dah block function fsockopen. lepas hantar ticket kat support, dorang cakap function [b]fsockopen[/b] tak block kat server. Tapi aku masih gagal untuk guna fungsi fsockopen. Tak tau kenapa. Aku rasa mungkin ada kaitan dengan Firewall.

Jadi soalan aku kat sini, ada tak solution utk masalah aku ni. Dah cuba guna CURL utk fetch data dari server pun sama. Mayday! Mayday!
  • 8 months later...
  • Author
Problem solved. aku guna XML Parsing untuk extract data dari server shoutcast.

1. Mula-mula generate XML file guna cron. Run every 1 minute. File XML ni akan disimpan dlm shoutcast server.

2. Kemudian kat dlm page radio player, guna function [color=#b22222]simplexml_load_file()[/color] dlm shoutcastinfo.php untuk load data xml dari server.

[CODE]<?php
$xml= simplexml_load_file("http://123.45.67.89/~shoutcast/shout.xml");
$blocks = $xml->xpath('//SONGTITLE'); //gets all <SONGTITLE/> tags
$blocks2 = $xml->xpath('//NEXTTITLE'); //gets all <NEXTTITLE/> tags
//$blocks3 = $xml->xpath('//layout/block'); //gets all <block/> which parent are <layout/> tags .

$current_song = $blocks[0];
$next_song = $blocks2[0];
echo "Current Song: " . $current_song . "<br />";
echo "Next Song: " . $next_song . "<br />";
//echo $blocks2;

?>[/CODE]

3. Last sekali, aku guna JQuery auto refresh untuk display current song kat dlm page, x perlu refresh page.

[CODE]<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_status').load('shoutcastinfo.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds
</script>[/CODE]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.