|
|
#1 |
|
Guest
Posts: n/a
|
XML Parser? API? Steam Group Stats on Webpage?
I have been trying for quite to locate these xml parsers everyone keeps saying they have that allow the integration of the steam community group and your website. All I would like to do is display any persons in my steam group, their achievements, avatar, minimal if there are any that do more that's awesome but I'd be grateful for just that.
|
|
|
|
#2 |
![]() Join Date: Mar 2007
Reputation: 0
Posts: 36
|
I don't know what coding language you use but this can maybe help you
http://steamcommunity.com/gid/<YOUR GROUP ID>/memberslistxml/?xml=1 |
|
|
|
|
|
#3 |
![]() Join Date: Sep 2006
Reputation: 1100
Posts: 5,486
|
I also would want pre-made XML parser PHP script.. If anyone has post some here, please.
|
|
|
|
|
|
#4 |
![]() Join Date: Oct 2005
Reputation: 17
Posts: 195
|
|
|
|
|
|
|
#5 | |
![]() Join Date: Sep 2006
Reputation: 1100
Posts: 5,486
|
Quote:
Im total noob with PHP. |
|
|
|
|
|
|
#6 |
![]() Join Date: Oct 2005
Reputation: 17
Posts: 195
|
heres a script i wrote to grab a steam community group info
usage eg. http://www.yoururl.com/group.php?group=clan-killers live eg. http://www.clan-killers.com/group.ph...p=clan-killers this isn't the cleanest script but it works ![]() Code:
<?php
// ######################### STEAM COMMUNITY #############################
$group = $_GET['group'];
// ######################### STEAM COMMUNITY ############################# 76561197965857367
$url = file_get_contents('http://steamcommunity.com/groups/'.$group);
ini_set('default_socket_timeout', 0);
preg_match('#<h1>(.+)</h1>#sU', $url, $aMatches);
echo "<a class='clanname' href='http://steamcommunity.com/groups/$group' target='_blank'>$aMatches[1]</a>";
echo "<br>";
preg_match('#<div class="groupMemberRow">(.+)</div>#sU', $url, $aMatches);
$aMatches = str_replace('class="linkStandard"', 'class="linkStandard" target="_blank"', $aMatches[1]);
echo "<span class='resultsb'>$aMatches</span>";
echo "<br>";
preg_match('#<div class="statsItemName">Steam Rating:</div>(.+)</div>#sU', $url, $aMatches);
echo "<span class='results'>Steam Rating:</span> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
echo "<br>";
preg_match('#<div class="statsItemName">Playing time:</div>(.+)</div>#sU', $url, $aMatches);
echo "<span class='results'>Playing Time:</span> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
echo "<br>";
preg_match('#<div class="statsItemName">Member Avg:</div>(.+)</div>#sU', $url, $aMatches);
echo "<span class='results'>Member Avg:</span> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
echo "<br>";
preg_match('#Counter-Strike:.*Source<br.*/>.*<span.*class="mostPlayedSmallText".*>(.+)</div>#sU', $url, $aMatches);
echo "<table><tr><td>";
echo "<img src='http://media.steampowered.com/steamcommunity/public/images/apps/240/3c7eb54d85e0317d8474858537bd2a26b85a64fa.jpg' align='absmiddle'> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
preg_match('#Team.*Fortress.*2<br.*/>.*<span.*class="mostPlayedSmallText".*>(.+)</div>#sU', $url, $aMatches);
echo "</td><td>";
echo "<img src='http://media.steampowered.com/steamcommunity/public/images/apps/440/e3f595a92552da3d664ad00277fad2107345f743.jpg' align='absmiddle'> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
echo "</td><td>";
preg_match('#Left.*4.*Dead<br.*/>.*<span.*class="mostPlayedSmallText".*>(.+)</div>#sU', $url, $aMatches);
echo "<img src='http://media.steampowered.com/steamcommunity/public/images/apps/500/428df26bc35b09319e31b1ffb712487b20b3245c.jpg' align='absmiddle'> ";
echo "<span class='resultsb'>$aMatches[1]</span>";
echo "</td></tr></table>";
preg_match('#<div class="avatarHolder_default"><div class="avatarFull"><img src="(.+)" /></div>#sU', $url, $aMatches);
?>
usage eg. http://www.yoururl.com/games.php?gam...AM_0:1:2795819 live eg. http://www.clan-killers.com/games.ph...AM_0:1:2795819 Code:
<?php
$align = $_GET['align'];
if($align != "")
{
echo '<table width="184" align="'.$align.'"><tr><td>';
}
// ######################### STEAM COMMUNITY #############################
$steamid = $_GET['id'];
$gameid = $_GET['game'];
$friendid = steam2friend($steamid);
function steam2friend($steam_id){
$steam_id=strtolower($steam_id);
if (substr($steam_id,0,7)=='steam_0') {
$tmp=explode(':',$steam_id);
if ((count($tmp)==3) && is_numeric($tmp[1]) && is_numeric($tmp[2])){
return bcadd((($tmp[2]*2)+$tmp[1]),'76561197960265728');
}else return false;
}else{
return false;
}
}
// ######################### STEAM COMMUNITY ############################# 76561197965857367
$url = file_get_contents('http://steamcommunity.com/profiles/'.$friendid.'/stats/'.$gameid.'?tab=stats');
preg_match('#<div class="gameLogo">(.+)</div>#sU', $url, $aMatches);
preg_match('#<img src="(.+)" /></a>#sU', $aMatches[1], $aMatches);
if($gameid != "CSS")echo '<a href="http://steamcommunity.com/profiles/'.$friendid.'" target="_blank"><img src="'.$aMatches[1].'"></a>';
if($gameid == "CSS")echo '<a href="http://steamcommunity.com/profiles/'.$friendid.'" target="_blank"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/240/2829d85b338a3bc2d10e2f39c9339d785ad8fcd2.jpg" border="0"></a>';
printf("\n<br />\n");
preg_match('#<h1>(.+)</h1>#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
// ## CSS
if($gameid == "CSS"){
echo " - $steamid";
printf("\n<br />\n");
$url = file_get_contents('http://steamcommunity.com/profiles/'.$friendid.'/games/');
preg_match('#<h4>Counter-Strike:.*Source</h4.*>(.+)</h5>#isU', $url, $aMatches);
$aMatches[1] = trim($aMatches[1]);
$aMatches[1] = substr($aMatches[1], 10);
echo " - $aMatches[1]";
printf("\n<br />\n");
}
// ## L4D
if($gameid == "L4D"){
preg_match('#<div id="topSummaryAchievements">(.+)Achievements Earned::<br />#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
preg_match('#s<br />(.+)</div>#', $url, $aMatches);
echo " - $aMatches[1]";
printf(" past 2 weeks\n<br />\n");
}
// ## TF2
if($gameid == "TF2"){
preg_match('#<div class="achievementStatusLeft">Personal Achievements Earned:</div>(.+)</div>#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
preg_match('#Playtime:<br />(.+)<div id="playtimeFooter">#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
}
// ## Killing Floor
if($gameid == "KillingFloor"){
preg_match('#<div id="topSummaryAchievements">(.+)Achievements Earned::<br />#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
preg_match('#<div id="tsblVal">(.+)</div>#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf(" past 2 weeks\n<br />\n");
}
// ## DOD Source
if($gameid == "DOD:S"){
preg_match('#<div id="topSummaryAchievements">(.+)Achievements Earned::<br />#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf("\n<br />\n");
preg_match('#<div id="tsblVal">(.+)</div>#sU', $url, $aMatches);
echo " - $aMatches[1]";
printf(" past 2 weeks\n<br />\n");
}
echo '<a href="games.php?game=CSS&id='.$steamid.'"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/240/3c7eb54d85e0317d8474858537bd2a26b85a64fa.jpg" border="0" alt="CSS" title="CSS"></a>';
echo '<a href="games.php?game=TF2&id='.$steamid.'"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/440/e3f595a92552da3d664ad00277fad2107345f743.jpg" border="0" alt="TF2" title="TF2"></a>';
echo '<a href="games.php?game=L4D&id='.$steamid.'"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/500/428df26bc35b09319e31b1ffb712487b20b3245c.jpg" border="0" alt="L4D" title="L4D"></a>';
echo '<a href="games.php?game=KillingFloor&id='.$steamid.'"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/1250/d8a2d777cb4c59cf06aa244166db232336520547.jpg" border="0" alt="KillingFloor" title="KillingFloor"></a>';
echo '<a href="games.php?game=DOD:S&id='.$steamid.'"><img src="http://media.steamcommunity.com/steamcommunity/public/images/apps/300/062754bb5853b0534283ae27dc5d58200692b22d.jpg" border="0" alt="DOD:S" title="DOD:S"></a>';
?>
</td></tr></table>
Last edited by SquareDisc: 09-17-2009 at 05:15 AM. |
|
|
|
|
|
#7 |
|
Banned
Join Date: Jul 2006
Reputation: 2337
Posts: 4,549
|
Yea... I wrote a PHP Class for the Community a while back... I haven't updated it since Valve started supplying XML because I thought people could handle it from there. :P
|
|
|
|
|
|
#8 |
![]() Join Date: Aug 2007
Reputation: 78
Posts: 2,130
|
Its part of a work in progress, but you can give this a whirl,
http://www.phillipmccallum.com/proje...2stats.php.txt and is used like thus, $Player = TF2StatViewer::GetProfile($PlayerName, $ProfileID); $Player->TF2Stats = an array of class objects for you to work with. ![]() It belongs to part of this, but its still a work in progress and is abit buggy and may look crap in some browsers, http://www.phillipmccallum.com/projects/tf2stats/ If you see any bugs in the code above, let me know.
|
|
|
|
|
|
#9 | |||
![]() Join Date: Sep 2006
Reputation: 1100
Posts: 5,486
|
Quote:
No matter if its clean or not I learn from ready made stuff lot easier than hard and unclear/unfinished examples.. (coding nowadays.. copy -> paste -> edit -> publish )Quote:
Quote:
|
|||
|
|
|
|
|
#10 | |
|
Banned
Join Date: Jul 2006
Reputation: 2337
Posts: 4,549
|
Quote:
|
|
|
|
|
|
|
#11 | |
![]() Join Date: Aug 2007
Reputation: 78
Posts: 2,130
|
Quote:
Theres group details available as well, but I haven't included that in my code.
|
|
|
|
|
|
|
#12 | |
![]() Join Date: Aug 2007
Reputation: 78
Posts: 2,130
|
Quote:
$Player = TF2StatViewer::GetProfile($PlayerName, $ProfileID, false); Will prevent it from getting TF2 stats. I've updated the script if anyone was using the original, better error handling for not being able to find the profile / stats + whether or not the stats are cached or not. |
|
|
|
|
|
|
#13 |
|
Guest
Posts: n/a
|
Is there anyway to parse an the exl using <steamID64> instead of <steamID> to gather information. The parse script I have will gather the info I need when I use (my profile):
http://steamcommunity.com/id/tehrooster?xml=1 but when I try to use: http://steamcommunity.com/profile/76...2461249r?xml=1 The script will not get the info. I see that when I try to connect to the profile xml, I'm redirected to the login page. |
|
|
|
#14 | |
|
Banned
Join Date: Jul 2006
Reputation: 2337
Posts: 4,549
|
Quote:
|
|
|
|
|
|
|
#15 |
![]() Join Date: Mar 2007
Reputation: 0
Posts: 36
|
I think the people at valve already fixed that.
yea they did. http://steamcommunity.com/profiles/7...93560336?xml=1 also note it's /profiles/ not /profile/ Code:
http://steamcommunity.com/profiles/<steamid64>?xml=1 Last edited by timgames: 09-25-2009 at 08:52 AM. |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|