/steam_source_stats.php
https://bitbucket.org/davestj/steam_stats · PHP · 75 lines · 31 code · 6 blank · 38 comment · 7 complexity · da85358cb65f6c4aec857c35fee18baa MD5 · raw file
- <?php
- /*
- steamcast xml source stats api
- Author: dstjohn (Mediacast1)
- Date started: 04-06-2005 (1:00A.M)
- Version: LNV (LATE NIGHT VERSION) 1.0 beta
- NOTES:
- This script is intended to get stats from one source of a steamcast server,
- if there is more then one source you will need to add and hack this script,
- your own your own and may the code be with you ;)
- */
- /************************************************************************************/
- include("./config.php");
- //connect to server
- $fp = fsockopen($steamip,$steamport,&$errno,&$errstr, 30);
- if(!$fp) {
- $steam_success = 1;
- echo 'Server Is Down';
- }
-
- if($steam_success != 1){
- fputs ($fp, "GET /admin/status.xml HTTP/1.1\r\n .
- User-Agent: Steamcast XML Parser (author: davestj@casterclub.com)(Mozilla Compatible)\r\n .
- Authorization: Basic ".base64_encode ("$adminuser:$adminpass")."\r\n\r\n");
- while(!feof($fp)) {
- $steam_page .= fgets($fp, 1000);
- }
- /************************************************************************************/
- //parse out source xml data
- //"description",
- $loop2 = array("mount", "status", "name", "description", "genre", "url", "bitrate",
- "meta_song", "meta_url", "nodes", "unique_nodes", "max_nodes", "average_connect_time", "tuneins", "extended_tuneins",
- "connect_time", "bandwidth", "bytes_recv", "bytes_sent", "content_type", "backup");
- $x=0;
- while($loop2[$x] != ''){
- $steam_pageed = ereg_replace(".*<$loop2[$x]>", "", $steam_page);
- $steam_php = strtolower($loop2[$x]);
- $$steam_php = ereg_replace("</$loop2[$x]>.*", "", $steam_pageed);
- if($loop[$y]==genre || $loop[$y]==description || $loop[$y]==meta_song){
- $$steam_php = urldecode($$steam_php);
- }
- // uncomment the next line to see all variables
- echo'$'.$steam_php.' = '.$$steam_php.'<br>';
- $x++;
- }
- fclose($fp);
- }
- //end xml parse
- /************************************************************************************/
- /*
- available php variables for this api
- $mount
- $status
- $name
- $description
- $genre
- $url
- $bitrate
- $meta_song
- $meta_url
- $nodes
- $max_nodes
- $average_connect_time
- $tuneins
- $extended_tuneins
- $connect_time
- $bytes_recv
- $content_type
- */
- ?>