Hi All,
Very first post here and I have a couple of requests in my question as I have been wracking my brain over this for a very long time, I have used many bits of scripts etc and done tons of research and managed to get my script working this much, please help anyone if you can.
TRYING TO DO THE FOLLOWING:
Page is found here BTW:
http://www.mdexter.com/aoe2hdozclan.com/rankings1.php
1 . Remove errors, some name entries have errors and an error that comes up with the following:
Warning: DOMDocument::load() [domdocument.load]: Document is empty in [url]http://steamcommunit...085870722?xml=1[/url], line: 1 in /home/mp/public_html/aoe2hdozclan.com/test.php on line 78
The line in question is:
isset($friendsOf) ? $friendsOf.'/' : ''
).'?xml=1&start=' . $start . '&end=' . $end,
LIBXML_NOBLANKS || LIBXML_NOCDATA
)) {
$entries = $feed->getElementsByTagName('entries');
if ($entries->length>0) {
THE LINE IN QUESTION IS THIS: )) {
which I have a temp fix using:
// Turn off all error reporting
error_reporting(0);
2. Change where avatar is and move it to where rating is, and move rating and rank to the right, and REMOVE UGCID alltogether
3. Add the avatarMedium from xml details below which adds an avatar image to the avatar column, details of parser found here:
<profile>
<steamID64>76561197963686471</steamID64>
<steamID>-Dare Devil/x/</steamID>
<onlineState>offline</onlineState>
<stateMessage>Last Online: 2 hrs, 33 mins ago</stateMessage>
<privacyState>public</privacyState>
<visibilityState>3</visibilityState>
−
<avatarIcon>
http://media.steampowered.com/steamcommunity/public/images/avatars/54/5407c772b001238b61a47762bb57494b0b940e96.jpg
</avatarIcon>
−
<avatarMedium>
http://media.steampowered.com/steamcommunity/public/images/avatars/54/5407c772b001238b61a47762bb57494b0b940e96_medium.jpg
</avatarMedium>
−
<avatarFull>
http://media.steampowered.com/steamcommunity/public/images/avatars/54/5407c772b001238b61a47762bb57494b0b940e96_full.jpg
</avatarFull>
<vacBanned>0</vacBanned>
<tradeBanState>None</tradeBanState>
<isLimitedAccount>0</isLimitedAccount>
<customURL>jsmucha</customURL>
<memberSince>January 1, 2004</memberSince>
<steamRating>10</steamRating>
<hoursPlayed2Wk>69.7</hoursPlayed2Wk>
<headline></headline>
<location>Danbury, Connecticut, United States</location>
<realname></realname>
<summary>I like dragons. And zombies.</summary>
−
<mostPlayedGames>
−
<mostPlayedGame>
<gameName>Age of Empires II: HD Edition</gameName>
<gameLink>http://steamcommunity.com/app/221380</gameLink>
−
<gameIcon>
http://media.steampowered.com/steamcommunity/public/images/apps/221380/109c74df17f9b67ea47d8f01e3d1ec25278b9f73.jpg
</gameIcon>
−
<gameLogo>
http://media.steampowered.com/steamcommunity/public/images/apps/221380/37e9da3f1174891fe38f8fb0206acda8b6bfc729.jpg
</gameLogo>
−
<gameLogoSmall>
http://media.steampowered.com/steamcommunity/public/images/apps/221380/37e9da3f1174891fe38f8fb0206acda8b6bfc729_thumb.jpg
</gameLogoSmall>
<hoursPlayed>58.1</hoursPlayed>
<hoursOnRecord>110</hoursOnRecord>
<statsName>AgeofEmpiresIIHDEdition</statsName>
The item to parse and create the avatar is: <avatarMedium>
And that is it for now I have tried so many types of scripts etc but I am coming up short, ok the full script of the page is below:
<?php
// Turn off all error reporting
error_reporting(0);
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
/*
I limited it to ten because it takes so long to pull every user's
profile! I suggest setting up some sort
of caching or daily updates
if deploying this live.
*/
$start = 1;
$end = 40;
$friendsOf = 133447;
$game = 'AgeofEmpiresIIHDEdition';
$feed = new DOMDocument();
if ($feed->load(
'http://steamcommunity.com/stats/' . $game . '/leaderboards/'.(
isset($friendsOf) ? $friendsOf.'/' : ''
).'?xml=1&start=' . $start . '&end=' . $end,
LIBXML_NOBLANKS || LIBXML_NOCDATA
)) {
$entries = $feed->getElementsByTagName('entries');
if ($entries->length>0) {
$entries = $entries->item(0)->getElementsByTagName('entry');
if ($entries->length>0) {
echo '
<table id="leaderBoard">
<caption>Age of Empires II HD Leaderboard</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Rating</th>
<th scope="col">Rank</th>
<th scope="col">UGCID</th>
<th scope="col">Avatar</th>
</tr>
<style>
table, th
body {
font-family:Verdana, Arial, Helvetica;
font-size: 110%;
padding-left: 15px;
margin: 0px;
color: #825a15;
font-weight:bold;
}
th, td
{
border:1px solid black;
}
td, th
{
background-color:ebcc9b;
}
th, td
{
padding-right: 15px;
}
th
{
padding-left: 15px;
}
</style>
</thead><tbody>';
foreach ($entries as $entry) {
$data = $entry->firstChild;
$user = new DOMDocument;
if ($user->load(
'http://steamcommunity.com/profiles/' . $data->nodeValue . '?xml=1',
LIBXML_NOBLANKS || LIBXML_NOCDATA
)) {
$userName = $user->getElementsByTagName('steamID')->item(0)->nodeValue;
// note ALL user data is available here
} else $userName = '<strong>ERROR</strong>';
echo '
<tr>
<th scope="row">', $userName, '</th>';
while ($data = $data->nextSibling) echo '
<td>', $data->nodeValue, '</td>';
echo '
</tr>';
} // foreach $entries
echo '
</tbody>
</table>';
} else echo '<p>no entries found in entry
table</p>';
} else echo '<p>no entries table found</p>';
} else echo '<p>unable to load feed</p>';
?>
<?php
// Do some form processing here
echo '<a href="rankings2.php" font="Arial" style="color: #7d4417">next</a>';
?>