PageRenderTime 122ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 57ms app.codeStats 0ms

/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
 1<?php
 2/*
 3steamcast xml source stats api
 4Author: dstjohn (Mediacast1)
 5Date started: 04-06-2005 (1:00A.M)
 6Version: LNV  (LATE NIGHT VERSION) 1.0 beta
 7NOTES:
 8This script is intended to get stats from one source of a steamcast server,
 9if there is more then one source you will need to add and hack this script,
10your own your own and may the code be with you ;)
11*/
12/************************************************************************************/
13include("./config.php");
14//connect to server
15$fp = fsockopen($steamip,$steamport,&$errno,&$errstr, 30);
16
17if(!$fp) {
18  $steam_success = 1;
19echo 'Server Is Down';
20}
21 
22if($steam_success != 1){
23fputs ($fp, "GET /admin/status.xml HTTP/1.1\r\n .
24User-Agent: Steamcast XML Parser (author: davestj@casterclub.com)(Mozilla Compatible)\r\n .
25Authorization: Basic ".base64_encode ("$adminuser:$adminpass")."\r\n\r\n"); 
26 while(!feof($fp)) {
27  $steam_page .= fgets($fp, 1000);
28 }
29/************************************************************************************/
30//parse out source xml data
31//"description",
32 $loop2 = array("mount", "status", "name", "description", "genre", "url", "bitrate",
33 "meta_song", "meta_url", "nodes", "unique_nodes", "max_nodes", "average_connect_time", "tuneins", "extended_tuneins",
34 "connect_time", "bandwidth", "bytes_recv", "bytes_sent", "content_type", "backup");
35 $x=0;
36 while($loop2[$x] != ''){
37  $steam_pageed = ereg_replace(".*<$loop2[$x]>", "", $steam_page);
38  $steam_php = strtolower($loop2[$x]);
39  $$steam_php = ereg_replace("</$loop2[$x]>.*", "", $steam_pageed);
40 if($loop[$y]==genre || $loop[$y]==description || $loop[$y]==meta_song){
41   $$steam_php = urldecode($$steam_php);
42 }
43
44// uncomment the next line to see all variables
45  echo'$'.$steam_php.' = '.$$steam_php.'<br>';
46  $x++;
47 }
48
49fclose($fp);
50}
51//end xml parse
52
53/************************************************************************************/
54/*
55available php variables for this api
56$mount
57$status
58$name
59$description
60$genre
61$url
62$bitrate
63$meta_song
64$meta_url
65$nodes
66$max_nodes
67$average_connect_time
68$tuneins
69$extended_tuneins
70$connect_time
71$bytes_recv
72$content_type
73*/
74
75?>