Steam XML Parser

As mentioned in a previous post, I’ve developed a WordPress plug-in to display a user’s Steam Stats as a widget. It’s available for download here. However, this does no good to anyone without a WordPress-based-site and I wanted to make the source freely available. As such, I’ve included it below. Valve provides Steam profiles as an XML feed which can be parsed and formatted according to a developer’s needs. To personalize the script, simply edit the URL following the “$profileURL” variable.

/* Steam Community Widget
	//Variables. Edit Profile URL to match the link to your personal Steam Community Page.
		$ProfileURL = '';
		$xml = simplexml_load_file($ProfileURL . '?xml=1');
			//Begin Widget Content
					echo '<p><strong>SteamID:</strong> ';
					echo $xml->steamID . '<br /><strong>Member since:</strong> ';
					echo $xml->memberSince . '<br /><strong>Steam Rating:</strong> ';
					echo $xml->steamRating . '<br /><strong>Playing time:</strong> ';
					echo $xml->hoursPlayed2Wk . " hrs past 2 weeks</p>";
					for($i = 0; $i < 4; $i++){
						if ($xml->mostPlayedGames->mostPlayedGame[$i]->gameLink != "") {
							echo '<p><a href="' . $xml->mostPlayedGames->mostPlayedGame[$i]->gameLink . '"><img src="' . $xml->mostPlayedGames->mostPlayedGame[$i]->gameIcon . '" /></a> ' . $xml->mostPlayedGames->mostPlayedGame[$i]->gameName . ' ' . $xml->mostPlayedGames->mostPlayedGame[$i]->hoursPlayed . ' hrs</p>';
				echo '<p><a href="' . $ProfileURL . 'games">View all games</a></p><p align="center"><em>&copy ' . date(Y) . ' <a href=""></a></em></p>';
			//End Widget Content
This entry was posted in Programming and tagged , , , , , , . Bookmark the permalink.

8 Responses to Steam XML Parser

  1. Pingback: Steam XML Parser | | Drakz Free Online Service

  2. Nicholas Pier says:

    My pleasure. I couldn’t find one that did what I wanted so I just made my own 😀 ! Hope you enjoy it, do what you want with the source code

  3. Steve says:

    Nice work, thanks! Been looking for a WordPress/Steam plugin and the code will come in handy for other projects!

  4. Henry says:

    Hi I was just wondering if you can call this plugin directly, as I am not really using sidebars on my site.

    How do i go about calling it on it’s own?


  5. Nicholas Pier says:

    The plugin is designed as a widget. I could redesign it where you’d enter text like < -- steamstats --> in a page or post like other plugins. However I don’t really have a need to redesign it. If you’d like it modified and are willing to paypal me like $15-20, I’d make the changes and send you a custom copy of the plugin.

  6. Sable says:


    I run a large online community and I wanted to know if this plugin could show group details instead of individual details?



  7. MikeMurko says:

    Cheers! I was just about to embark on a similar quest … thanks for releasing the code. I first saw a forum post of yours that said it was a WordPress plugin, and I was dreading going through the source and de-tangling it from WP.

    Right now I’m rewriting my WP blog from scratch in CodeIgniter so this is a huge help.


  8. John says:


    This is really cool but doesn’t do quite what I’m after. I want a plugin for my site that would show the status for our steam group members that are currently online (parses out the offline members) and shows what game they are in, etc. I keep trying to do it and failing miserably.

    Do you have something like this?


Leave a Reply

Your email address will not be published. Required fields are marked *