I have a small php script that requires a URL resolve of
http://www.angrygaming.org/steamgroup.php?group=angrygamer
to identify for the php script what group to extract the data for. How would I go about with modx displaying that within the template of the site. I typically used ruby to handle my parses but with steam and another game I am currently working on extracting the XML info from I find php to be the flavor of the month.
So this is my code I used to extract my steam group info
<?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);
?>
So I was thinking i need a way for a chunk to display my above snippet with the
http://www.angrygaming.org/steamgroup.php?group=angrygamer address all within my template is this possible? I am trying to explain it as best I can.
the URL alone identifies the parameters for my script to pull the specific data. Basically
http://www.angrygaming.org/steamgroup.php?group=angrygamer "group=angrygamer" could be changed to any group and it will extract that groups info. so the URL is key as it defines all the parameters for my script.
*edit I think I may be able to do this with an iframe going to read how browser friendly this method would be.
*edit nevermind I am just going to have to re-write this to execute within the script itself so I can this just apply it as a snippet.
*edit just had to replace $group = $_GET[’group’]; with $group = "angrygamer";