60 lines
2.3 KiB
PHP
60 lines
2.3 KiB
PHP
<?php
|
|
/*
|
|
* SteamGroupStatus
|
|
* Copyright (C) 2012 Maximilian "MadMakz" Lotz
|
|
*
|
|
* http://madmakz.com/
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 3 as published by
|
|
* the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
$gruppe = "valve"; // Der Gruppenname hinter http://steamcommunity.com/groups/
|
|
echo stgrp_status($gruppe);
|
|
|
|
function stgrp_status($group = false){
|
|
if(!$group){ return false; }
|
|
|
|
$error_reporting = error_reporting();
|
|
error_reporting(0);
|
|
$url = file_get_contents('http://steamcommunity.com/groups/'.$group);
|
|
$default_socket_timeout = ini_get("default_socket_timeout");
|
|
ini_set("default_socket_timeout", 0);
|
|
if($http_response_header[0] != "HTTP/1.1 200 OK"){
|
|
error_reporting($error_reporting);
|
|
ini_set("default_socket_timeout", $default_socket_timeout);
|
|
return "<div class=\"blockrow\"><b>Steamcommunity appears to be down.</b></div>";
|
|
}
|
|
error_reporting($error_reporting);
|
|
ini_set("default_socket_timeout", $default_socket_timeout);
|
|
|
|
$return .= "<div class=\"blockrow\">\n";
|
|
|
|
preg_match("#<h1>(.+)</h1>#sU", $url, $aTitle);
|
|
$return .= "<a class=\"clanname\" href='http://steamcommunity.com/groups/$group' target='_blank'>".$aTitle[1]."</a>\n";
|
|
$return .= "<br>\n";
|
|
|
|
preg_match("#<span class=\"count \">(.+)</span>#sU", $url, $aMembers);
|
|
$return .= "<span class=\"resultsb\">".$aMembers[1]." Members</span>\n";
|
|
$return .= "<br>\n";
|
|
|
|
preg_match_all("#<div class=\"count \">(.+)</div>#sU", $url, $aActive);
|
|
$return .= "<span class=\"membersInGame\"><font color=#8bc53f>".$aActive[1][0]." In-Game</font></span>\n";
|
|
$return .= "<br>";
|
|
$return .= "<span class=\"membersOnline\"><font color=#62a7e3>".$aActive[1][1]." Online</font></span>\n";
|
|
|
|
$return .= "</div>";
|
|
|
|
return $return;
|
|
}
|
|
?>
|