diff --git a/PHP/Steam/SteamGroupStatus/sgs_curl.php b/PHP/Steam/SteamGroupStatus/sgs_curl.php new file mode 100644 index 0000000..1796a42 --- /dev/null +++ b/PHP/Steam/SteamGroupStatus/sgs_curl.php @@ -0,0 +1,73 @@ +. + * + */ + +$gruppe = "cgx24"; // Groupname at the end of http://steamcommunity.com/groups/ +echo stgrp_status($gruppe); + +function stgrp_status($group = false){ + if(!$group){ return "
No group set.
"; } + + $error_reporting = error_reporting(); + error_reporting(0); + $url = file_get_contents_curl('http://steamcommunity.com/groups/'.$group, "SteamGroupStatus Query Script"); + if($url["header"]["http_code"] != "200"){ + error_reporting($error_reporting); + return "
Steamcommunity appears to be down.
"; + } + error_reporting($error_reporting); + + $return = "
\n"; + + preg_match("#

(.+)

#sU", $url["data"], $aMatches); + $return .= "".$aMatches[1]."\n"; + $return .= "
\n"; + + preg_match("#(.+)#sU", $url["data"], $aMembers); + $return .= "".$aMembers[1]." Members\n"; + $return .= "
\n"; + + preg_match_all("#
(.+)
#sU", $url["data"], $aActive); + $return .= "".$aActive[1][0]." In-Game\n"; + $return .= "
"; + $return .= "".$aActive[1][1]." Online\n"; + + $return .= "
"; + + return $return; +} + + +function file_get_contents_curl($url, $agent = "My Agent"){ + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. + curl_setopt($ch, CURLOPT_USERAGENT, $agent); + curl_setopt($ch, CURLOPT_URL, $url); + + $data = curl_exec($ch); + $header = curl_getinfo($ch); + + curl_close($ch); + + return array("data" => $data, "header" => $header); +} +?> \ No newline at end of file