<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<TITLE>PHP-Class :: ShoutcastInfo :: Documentation</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
/*********************************
*
* globale HTML Styles
*
*/
a:link
{
color: #0079C5;
background: transparent;
text-decoration: none;
}
a:visited
{
color: #5DA3ED;
background: transparent;
text-decoration: none;
}
a:hover,
a:active,
a:focus
{
color: #cd3021;
background: transparent;
text-decoration: underline;
}
html,
body
{
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
margin-right: 20px;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
}
body
{
background-color: #FFFFFF;
color: #000000;
font-family: Verdana, Helvetica, Arial, sans-serif;
}
h3
{
margin-left: 30px;
margin-right: 10px;
background: transparent;
color: #222222;
font-size: 18px;
font-style: normal;
font-weight: bold;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
line-height: 100%;
letter-spacing: 1px;
}
h4 {
margin-top: 20px;
margin-left: 30px;
margin-right: 5px;
background: transparent;
color: #000000;
font-size: 14px;
font-style: normal;
font-weight: bold;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
line-height: 100%;
}
p {
margin-left: 30px;
margin-right: 20px;
font-size: 12px;
font-style: normal;
font-weight: normal;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
background: transparent;
color: #000000;
}
.box
{
margin-left: 30px;
margin-right: 30px;
margin-top: 20px;
margin-bottom: 20px;
border-style: dashed;
border-width: 2px;
border-color: #FFD940;
}
.phpclass
{
margin-left: 30px;
margin-right: 20px;
font-size: 14px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<h3>PHP-Class :: HN ShoutcastInfo :: Documentation</h3>
<p>Author: Horst Nogajski<br>
Licence: GNU GPL (http://www.opensource.org/licenses/gpl-license.html)<br>
Version: 1.0 (2005-01-06)</p>
<p class="phpclass">You can download the class at <a href="http://hn273.users.phpclasses.org/browse/package/2049.html">phpclasses.org</a>!</p>
<p> </p>
<div class="box">
<h4>Retrieve Information from ShoutcastServers</h4>
<p>Current version 1.0 supports direct connection to Shoutcast-Servers,<br>
simple HTTP-Proxy-Connections and HTTP-Proxy-Connections with user:pass</p>
<p>Automatic handling of accidential connections to a stream instead to the HTML-Infopage!<br>
(Maybe happen sometimes, if you automatically retrieve URLs from playlists and pass them to the class)<br>
The class then try to connect to the server by it's root-dir and/or to the Shoutcast-Defaultport.</p>
<p>The class can be used in web-environment or with commandline-scripts.</p>
</div>
<div class="box">
<h4>Basic-Class "hn_shoutcast"</h4>
<p><u>METHODS:</u></p>
<p>When calling classinstance, you can switch on/off debugging, and optional define a socket-timeout in seconds:<br>
- <b>hn_shoutcast($http_debug=FALSE, $socket_timeout=10)</b></p>
<p>Now there is only one method needed to query a server and retrieve all available Information:<br>
- <b>query_URL($url, $proxy=NULL)</b><br>
<br>
$url is the server or server:port-combination to query,<br>
optional argument $proxy can be something like: <b>http://proxyhost:port</b> or <b>http://username:hide@address.com:port</b>.<br>
<br>
The method doesn't send username and password in plain-text, it only needs the argument passed in this way.</p>
<p>If the station is online, the class-var <b>$online</b> is TRUE, otherwise FALSE. </p>
<p>If query_URL has success and the station is online, we have all available Infos stored in array <b>$info</b>:<pre>
- 'Server Status'
- 'Stream Status'
- 'Stream Title'
- 'Stream URL'
- 'Content Type'
- 'Bandwidth'
- 'Stream Genre'
- 'Current Song'
- 'Listeners'
- 'MaxListeners'
- 'Listener Peak'
- 'Average Listen Time'
- 'Stream AIM'
- 'Stream IRC'
- 'Stream ICQ'
</pre>
<p>(And also all other infos what was served from the station.)</p>
<p>All empty fieldvalues in array <b>$info</b> becomes per default 'N/A'. This is set in class-var <b>$NotAvailable</b>. You can define another value if you like, (maybe FALSE).</p>
</div>
<div class="box">
<h4>Class-Extension "hn_shoutcastInfo"</h4>
<p>With this extension you have easy access to each single information. If an Information is not available the value of class-var <b>$NotAvailable</b> is returned by the methods.</p>
<p>So, now it's up to you, to decide if you want access the infos in array <b>$info['field name']</b> or by calling the below methods, ;-)</p>
<p><u>METHODS:</u></p>
<pre><b>
- is_online()
- station()
- url()
- content_type()
- genre()
- song()
- bandwidth()
- listeners()
- maxlisteners()
- listenerpeak()
- aim()
- irc()
- icq()</b></pre>
</div>
<div class="box">
<h4>Simple example with debugging can be tested here:<br><br><a href="hn_shoutcast.example1.php" target="shoutcast_example">example for commandline- and web-environment</a></h4>
</div>
</body>
</html>