<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for TheGameCollective</title>
	<atom:link href="http://blog.thegamecollective.co.uk/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.thegamecollective.co.uk</link>
	<description>Gaming chit chat</description>
	<lastBuildDate>Thu, 21 Jan 2010 08:02:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on PlayStation 3 Trophies API by john</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-224</link>
		<dc:creator>john</dc:creator>
		<pubDate>Thu, 21 Jan 2010 08:02:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-224</guid>
		<description>There is a way to fix the games names issue, the script isn&#039;t interpreting the string name correctly. There&#039;s encoding of some type, which I&#039;ve not gotten round to. I&#039;ll look into this. Also, it should work on Chrome :O So my bad!</description>
		<content:encoded><![CDATA[<p>There is a way to fix the games names issue, the script isn&#8217;t interpreting the string name correctly. There&#8217;s encoding of some type, which I&#8217;ve not gotten round to. I&#8217;ll look into this. Also, it should work on Chrome :O So my bad!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by aur8l</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-223</link>
		<dc:creator>aur8l</dc:creator>
		<pubDate>Wed, 20 Jan 2010 18:32:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-223</guid>
		<description>No, actually it works, but not on Google Chrome... My bad !
But, is there any way to have &quot;clean&quot; games&#039; names ?</description>
		<content:encoded><![CDATA[<p>No, actually it works, but not on Google Chrome&#8230; My bad !<br />
But, is there any way to have &#8220;clean&#8221; games&#8217; names ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by john</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-220</link>
		<dc:creator>john</dc:creator>
		<pubDate>Mon, 18 Jan 2010 21:41:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-220</guid>
		<description>It&#039;s working for me at the moment - it might be a timeout issue, maybe the psn server didn&#039;t respond in time? Can you tell me the error you saw?</description>
		<content:encoded><![CDATA[<p>It&#8217;s working for me at the moment &#8211; it might be a timeout issue, maybe the psn server didn&#8217;t respond in time? Can you tell me the error you saw?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by aur8l</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-219</link>
		<dc:creator>aur8l</dc:creator>
		<pubDate>Mon, 18 Jan 2010 20:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-219</guid>
		<description>But, it&#039;s not functionnal right now using the link :
http://www.thegamecollective.co.uk/psn.php?psnid=dunnestar
?</description>
		<content:encoded><![CDATA[<p>But, it&#8217;s not functionnal right now using the link :<br />
<a href="http://www.thegamecollective.co.uk/psn.php?psnid=dunnestar" rel="nofollow">http://www.thegamecollective.co.uk/psn.php?psnid=dunnestar</a><br />
?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by john</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-218</link>
		<dc:creator>john</dc:creator>
		<pubDate>Mon, 18 Jan 2010 19:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-218</guid>
		<description>Hi aur8l, I&#039;ll post the code shortly. It&#039;s not perfect and may still have some bugs in it! Let me know how you get on with it, and if you make any improvements, I&#039;d appreciate a look!

&lt;code&gt;
&lt;?php
function parsePsn( $psnid, $output = &quot;array&quot; )
{
   if( strlen( $psnid ) === 0 )
   {
      die(&quot;Unknown PSN id&quot;);
   }
   if( $output === &quot;array&quot; )
   {
      $return_data = array();
   }
   else
   {
      $return_data = &quot;&quot;;
   }
   $url = &quot;http://profiles.us.playstation.com/playstation/psn/visit/profiles/&quot;.$psnid;

   $debug = false;

   $user_agent = $_SERVER[&#039;HTTP_USER_AGENT&#039;];
   if( strlen( $useragent ) == 0 )
      $useragent = &quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)&quot;;

   $cc = new mycurl( $url, $useragent );
   $cc-&gt;createCurl();
   $content = $cc;

   $look = array(&quot;Platinum&quot;,&quot;Gold&quot;,&quot;Silver&quot;,&quot;Bronze&quot;);
   $trophies = array();
   foreach( $look as $t )
   {
      $platinum_match = &quot;/([0-9]*) &quot;.$t.&quot;/&quot;;
      preg_match($platinum_match,$content,$matches);
      $trophies[ strtolower($t) ] = $matches[1];
   }

   $platinum_match = &quot;/&lt;div id=\&quot;leveltext\&quot;&gt;[ ]*([0-9]*)&lt;/&quot;;
   preg_match($platinum_match,$content,$matches);
   $trophies[ &#039;level&#039; ] = $matches[1];

   #
   #
   # Now extract the players icon
   $image_match=&quot;/img width=\&quot;[^\&quot;]*\&quot; height=\&quot;[^\&quot;]*\&quot; border=\&quot;0\&quot; alt=\&quot;[^\&quot;]*\&quot; src=\&quot;([^\&quot;]*)\&quot;\/&gt;/&quot;;
   preg_match_all($image_match,$content,$matches);
   if( $debug ) print_r( $matches );

   if( $output === &quot;xml&quot; )
   {
      #header(&#039;Content-type: text/xml&#039;);
      $return_data .= &quot;&lt;?xml version=&#039;1.0&#039; encoding=&#039;ISO-8859-1&#039;?&gt;\n&quot;;
      $return_data .= &quot;&lt;gamerdata&gt;\n&quot;;
      $return_data .= &quot;   &lt;psn psnname=\&quot;&quot;.$psnid.&quot;\&quot; avatar=\&quot;&quot;.$matches[1][0].&quot;\&quot; level=\&quot;&quot;.$trophies[&#039;level&#039;].&quot;\&quot; totalbronze=\&quot;&quot;.$trophies[&#039;bronze&#039;].&quot;\&quot; totalsilver=\&quot;&quot;.$trophies[&#039;silver&#039;].&quot;\&quot; totalgold=\&quot;&quot;.$trophies[&#039;gold&#039;].&quot;\&quot; totalplatinum=\&quot;&quot;.$trophies[&#039;platinum&#039;].&quot;\&quot;&gt;\n&quot;;
   } else if( $output === &quot;key&quot; )
   {
      #header(&#039;Content-type: text/plain&#039;);
      $return_data .= &quot;name=&quot;. $psnid .&quot;\n&quot;;
      $return_data .= &quot;avatar=&quot;. $matches[1][0].&quot;\n&quot;;
      $return_data .= &quot;level=&quot;. $trophies[&#039;level&#039;].&quot;\n&quot;;
      $return_data .= &quot;totalbronze=&quot;. $trophies[&#039;bronze&#039;].&quot;\n&quot;;
      $return_data .= &quot;totalsilver=&quot;. $trophies[&#039;silver&#039;].&quot;\n&quot;;
      $return_data .= &quot;totalgold=&quot;. $trophies[&#039;gold&#039;].&quot;\n&quot;;
      $return_data .= &quot;totalplatinum=&quot;. $trophies[&#039;platinum&#039;].&quot;\n&quot;;
   } else if( $output === &quot;array&quot; )
   {
      $return_data[&#039;name&#039;] = $psnid;
      $return_data[&#039;avatar&#039;] = $matches[1][0];
      $return_data[&#039;level&#039;] = $trophies[&#039;level&#039;];
      $return_data[&#039;totalbronze&#039;] = $trophies[&#039;bronze&#039;];
      $return_data[&#039;totalsilver&#039;] = $trophies[&#039;silver&#039;];
      $return_data[&#039;totalgold&#039;] = $trophies[&#039;gold&#039;];
      $return_data[&#039;totalplatinum&#039;] = $trophies[&#039;platinum&#039;];
   } else {
      die(&quot;No output defined&quot;);
   }

   $cc = new mycurl( &quot;http://profiles.us.playstation.com/playstation/psn/profile/&quot;.$psnid.&quot;/get_ordered_trophies_data&quot;, $useragent );
   $cc-&gt;createCurl();
   $content = str_replace( &quot; &quot;, &quot;&quot;, $cc );

   $platinum_match = &quot;/&lt;spanclass=\&quot;gameTitleSortField\&quot;&gt;(.*)&lt;\/span&gt;/&quot;;
   preg_match_all($platinum_match,$content,$games);

   $content = str_replace( &quot;\n&quot;, &quot;&quot;, $content );
   $content = str_replace( &quot;\r&quot;, &quot;&quot;, $content );

   $platinum_match = &quot;/&lt;divclass=\&quot;trophycontent\&quot;&gt;([^&lt;]*)&lt;\/div&gt;/&quot;;
   preg_match_all($platinum_match,$content,$matches);

   if( $debug ) print_r( $games );
   $game_icon_match = &quot;/&lt;imgborder=\&quot;0\&quot;alt=\&quot;\&quot;src=\&quot;([^\&quot;]*)\&quot;\/&gt;/&quot;;
   preg_match_all($game_icon_match,$content,$game_icons);
   if( $debug ) print_r( $game_icons );

   $game_trophies_match = &quot;/&lt;divclass=\&quot;titlelogo\&quot;&gt;&lt;ahref=\&quot;([^\&quot;]*)\&quot;&gt;/&quot;;
   preg_match_all($game_trophies_match,$content,$game_trophies);
   if( $debug ) print_r( $game_trophies );

   $game_completed_match = &quot;/&lt;spanclass=\&quot;gameProgressSortField\&quot;&gt;([^&lt;]*)&lt;\/span&gt;%/&quot;;
   preg_match_all($game_completed_match,$content,$game_completed);
   if( $debug ) print_r( $game_completed );

   if( $output === &quot;key&quot; )
   {
      $return_data .= &quot;numgames=&quot;.count($games[1]).&quot;\n&quot;;
   } else if( $output === &quot;array&quot; )
   {
      $return_data[&#039;numgames&#039;] = count($games[1]);
   }

   #
   #
   #  Replace HTTP:// from urls for xml
   $search_http  = array(&#039;http://&#039;,&#039;HTTP://&#039;);
   $replace_http = array(&#039;&#039;);
   $search_colon  = array(&#039;:&#039;,&#039;&amp;&#039;);
   $replace_colon = array(&#039;-&#039;,&#039;and&#039;);
   $users_games = array();

   $counter = 0;
   $num = 0;

   if( $output === &quot;array&quot; )
   {
      $all_games = array();
   }

   foreach ( $games[1] as $game )
   {
      $gametitle = str_replace( $search_colon, $replace_colon, html_entity_decode( $game ) );
      $trophies_url = &quot;http://profiles.us.playstation.com&quot;.$game_trophies[1][$num];
      $completed = $game_completed[1][$num];
      if( $output === &quot;xml&quot; )
      {
         $return_data .= &quot;&lt;game gametitle=\&quot;&quot;.$gametitle.&quot;\&quot; bronze=\&quot;&quot;.$matches[1][$counter].&quot;\&quot; silver=\&quot;&quot;.$matches[1][$counter+1].&quot;\&quot; gold=\&quot;&quot;.$matches[1][$counter+2].&quot;\&quot; platinum=\&quot;&quot;.$matches[1][$counter+3] .&quot;\&quot; game_image=\&quot;&quot;.$game_icons[1][$num].&quot;\&quot; game_trophies=\&quot;&quot;.$trophies_url.&quot;\&quot;/&gt;&quot;;
         $num++;
      } else if( $output === &quot;key&quot; )
      {
         $num++;
         $return_data .= &quot;name_&quot;. $num .&quot;=&quot;. $gametitle.&quot;\n&quot;;
         $return_data .= &quot;bronze_&quot;. $num.&quot;=&quot;. $matches[1][$counter].&quot;\n&quot;;
         $return_data .= &quot;silver_&quot;. $num.&quot;=&quot;. $matches[1][$counter+1].&quot;\n&quot;;
         $return_data .= &quot;gold_&quot;. $num.&quot;=&quot;. $matches[1][$counter+2].&quot;\n&quot;;
         $return_data .= &quot;platinum_&quot;. $num.&quot;=&quot;. $matches[1][$counter+3].&quot;\n&quot;;
         $return_data .= &quot;image_&quot;. $num.&quot;=&quot;. $game_icons[1][$num-1].&quot;\n&quot;;
         $return_data .= &quot;trophiesurl_&quot;. $num.&quot;=&quot;. $trophies_url.&quot;\n&quot;;
      } else if( $output === &quot;array&quot; )
      {
         $num++;
         $sub_game = array();
         $sub_game[&#039;name&#039;] = $gametitle;
         $sub_game[&#039;gametitle&#039;] = $gametitle;
         $sub_game[&#039;bronze&#039;] = $matches[1][$counter];
         $sub_game[&#039;silver&#039;] = $matches[1][$counter+1];
         $sub_game[&#039;gold&#039;] = $matches[1][$counter+2];
         $sub_game[&#039;platinum&#039;] = $matches[1][$counter+3];
         $sub_game[&#039;image&#039;] = $game_icons[1][$num-1];
         $sub_game[&#039;trophiesurl&#039;] = $trophies_url;
         $sub_game[&#039;completed&#039;] = $completed;
         array_push( $all_games, $sub_game );
      }
      $counter+=4;
   }
   if( $debug ) print_r( $trophies );

   if( $output === &quot;array&quot; )
   {
      $return_data[&#039;games&#039;] = $all_games;
   }

   if( $output === &quot;xml&quot; )
   {
      $return_data.= &quot;&lt;/psn&gt;&quot;;
      $return_data.= &quot;&lt;/gamerdata&gt;&quot;;
   }
   return $return_data;
}

 class mycurl {
     protected $_useragent;
     protected $_url;
     protected $_followlocation;
     protected $_timeout;
     protected $_maxRedirects;
     protected $_cookieFileLocation = &#039;./cookie.txt&#039;;
     protected $_post;
     protected $_postFields;
     protected $_referer =&quot;http://www.thegamecollective.co.uk&quot;;

     protected $_session;
     protected $_webpage;
     protected $_includeHeader;
     protected $_noBody;
     protected $_status;
     protected $_binaryTransfer;
     public    $authentication = 0;
     public    $auth_name      = &#039;&#039;;
     public    $auth_pass      = &#039;&#039;;

     public function useAuth($use){
       $this-&gt;authentication = 0;
       if($use == true) $this-&gt;authentication = 1;
     }

     public function setName($name){
       $this-&gt;auth_name = $name;
     }
     public function setPass($pass){
       $this-&gt;auth_pass = $pass;
     }

     public function __construct($url,$useragent=&quot;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1&quot;,$followlocation = true,$timeOut = 30,$maxRedirecs = 4,$binaryTransfer = false,$includeHeader = false,$noBody = false)
     {
         $this-&gt;_url = $url;
         $this-&gt;_followlocation = $followlocation;
         $this-&gt;_timeout = $timeOut;
         $this-&gt;_maxRedirects = $maxRedirecs;
         $this-&gt;_noBody = $noBody;
         $this-&gt;_includeHeader = $includeHeader;
         $this-&gt;_binaryTransfer = $binaryTransfer;
         $this-&gt;_useragent = $useragent;

         $this-&gt;_cookieFileLocation = dirname(__FILE__).&#039;/cookie.txt&#039;;

     }

     public function setReferer($referer){
       $this-&gt;_referer = $referer;
     }

     public function setCookiFileLocation($path)
     {
         $this-&gt;_cookieFileLocation = $path;
     }

     public function setPost ($postFields)
     {
        $this-&gt;_post = true;
        $this-&gt;_postFields = $postFields;
     }
     public function setUserAgent($userAgent)
     {
         $this-&gt;_useragent = $userAgent;
     }

     public function createCurl($url = &#039;nul&#039;)
     {
        if($url != &#039;nul&#039;){
          $this-&gt;_url = $url;
        }

         $s = curl_init();

         curl_setopt($s,CURLOPT_URL,$this-&gt;_url);
         curl_setopt($s,CURLOPT_HTTPHEADER,array(&#039;Expect:&#039;));
         curl_setopt($s,CURLOPT_TIMEOUT,$this-&gt;_timeout);
         curl_setopt($s,CURLOPT_MAXREDIRS,$this-&gt;_maxRedirects);
         curl_setopt($s,CURLOPT_RETURNTRANSFER,true);
         curl_setopt($s,CURLOPT_FOLLOWLOCATION,$this-&gt;_followlocation);
         curl_setopt($s,CURLOPT_COOKIEJAR,$this-&gt;_cookieFileLocation);
         curl_setopt($s,CURLOPT_COOKIEFILE,$this-&gt;_cookieFileLocation);

         if($this-&gt;authentication == 1){
           curl_setopt($s, CURLOPT_USERPWD, $this-&gt;auth_name.&#039;:&#039;.$this-&gt;auth_pass);
         }
         if($this-&gt;_post)
         {
             curl_setopt($s,CURLOPT_POST,true);
             curl_setopt($s,CURLOPT_POSTFIELDS,$this-&gt;_postFields);

         }

         if($this-&gt;_includeHeader)
         {
               curl_setopt($s,CURLOPT_HEADER,true);
         }

         if($this-&gt;_noBody)
         {
             curl_setopt($s,CURLOPT_NOBODY,true);
         }
         /*
         if($this-&gt;_binary)
         {
             curl_setopt($s,CURLOPT_BINARYTRANSFER,true);
         }
         */
         curl_setopt($s,CURLOPT_USERAGENT,$this-&gt;_useragent);
         curl_setopt($s,CURLOPT_REFERER,$this-&gt;_referer);

         $this-&gt;_webpage = curl_exec($s);
                   $this-&gt;_status = curl_getinfo($s,CURLINFO_HTTP_CODE);
         curl_close($s);

     }

   public function getHttpStatus()
   {
       return $this-&gt;_status;
   }

   public function __tostring(){
      return $this-&gt;_webpage;
   }
}
?&gt;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi aur8l, I&#8217;ll post the code shortly. It&#8217;s not perfect and may still have some bugs in it! Let me know how you get on with it, and if you make any improvements, I&#8217;d appreciate a look!</p>
<p><code><br />
< ?php<br />
function parsePsn( $psnid, $output = "array" )<br />
{<br />
   if( strlen( $psnid ) === 0 )<br />
   {<br />
      die("Unknown PSN id");<br />
   }<br />
   if( $output === "array" )<br />
   {<br />
      $return_data = array();<br />
   }<br />
   else<br />
   {<br />
      $return_data = "";<br />
   }<br />
   $url = "http://profiles.us.playstation.com/playstation/psn/visit/profiles/".$psnid;</p>
<p>   $debug = false;</p>
<p>   $user_agent = $_SERVER['HTTP_USER_AGENT'];<br />
   if( strlen( $useragent ) == 0 )<br />
      $useragent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)";</p>
<p>   $cc = new mycurl( $url, $useragent );<br />
   $cc->createCurl();<br />
   $content = $cc;</p>
<p>   $look = array("Platinum","Gold","Silver","Bronze");<br />
   $trophies = array();<br />
   foreach( $look as $t )<br />
   {<br />
      $platinum_match = "/([0-9]*) ".$t."/";<br />
      preg_match($platinum_match,$content,$matches);<br />
      $trophies[ strtolower($t) ] = $matches[1];<br />
   }</p>
<p>   $platinum_match = "/
<div id=\"leveltext\">[ ]*([0-9]*)/";<br />
   preg_match_all($image_match,$content,$matches);<br />
   if( $debug ) print_r( $matches );</p>
<p>   if( $output === "xml" )<br />
   {<br />
      #header('Content-type: text/xml');<br />
      $return_data .= "< ?xml version='1.0' encoding='ISO-8859-1'?>\n";<br />
      $return_data .= "<gamerdata>\n";<br />
      $return_data .= "
<psn psnname=\"".$psnid."\" avatar=\"".$matches[1][0]."\" level=\"".$trophies['level']."\" totalbronze=\"".$trophies['bronze']."\" totalsilver=\"".$trophies['silver']."\" totalgold=\"".$trophies['gold']."\" totalplatinum=\"".$trophies['platinum']."\">\n";<br />
   } else if( $output === "key" )<br />
   {<br />
      #header('Content-type: text/plain');<br />
      $return_data .= "name=". $psnid ."\n";<br />
      $return_data .= "avatar=". $matches[1][0]."\n";<br />
      $return_data .= "level=". $trophies['level']."\n";<br />
      $return_data .= "totalbronze=". $trophies['bronze']."\n";<br />
      $return_data .= "totalsilver=". $trophies['silver']."\n";<br />
      $return_data .= "totalgold=". $trophies['gold']."\n";<br />
      $return_data .= "totalplatinum=". $trophies['platinum']."\n";<br />
   } else if( $output === "array" )<br />
   {<br />
      $return_data['name'] = $psnid;<br />
      $return_data['avatar'] = $matches[1][0];<br />
      $return_data['level'] = $trophies['level'];<br />
      $return_data['totalbronze'] = $trophies['bronze'];<br />
      $return_data['totalsilver'] = $trophies['silver'];<br />
      $return_data['totalgold'] = $trophies['gold'];<br />
      $return_data['totalplatinum'] = $trophies['platinum'];<br />
   } else {<br />
      die("No output defined");<br />
   }</p>
<p>   $cc = new mycurl( "http://profiles.us.playstation.com/playstation/psn/profile/".$psnid."/get_ordered_trophies_data", $useragent );<br />
   $cc->createCurl();<br />
   $content = str_replace( " ", "", $cc );</p>
<p>   $platinum_match = "/<spanclass =\"gameTitleSortField\">(.*)< \/span>/";<br />
   preg_match_all($platinum_match,$content,$games);</p>
<p>   $content = str_replace( "\n", "", $content );<br />
   $content = str_replace( "\r", "", $content );</p>
<p>   $platinum_match = "/
<divclass =\"trophycontent\">([^< ]*)<\/div>/";<br />
   preg_match_all($platinum_match,$content,$matches);</p>
<p>   if( $debug ) print_r( $games );<br />
   $game_icon_match = "/<imgborder =\"0\"alt=\"\"src=\"([^\"]*)\"\/>/";<br />
   preg_match_all($game_icon_match,$content,$game_icons);<br />
   if( $debug ) print_r( $game_icons );</p>
<p>   $game_trophies_match = "/</divclass>
<divclass =\"titlelogo\"><ahref =\"([^\"]*)\">/";<br />
   preg_match_all($game_trophies_match,$content,$game_trophies);<br />
   if( $debug ) print_r( $game_trophies );</p>
<p>   $game_completed_match = "/<spanclass =\"gameProgressSortField\">([^< ]*)<\/span>%/";<br />
   preg_match_all($game_completed_match,$content,$game_completed);<br />
   if( $debug ) print_r( $game_completed );</p>
<p>   if( $output === "key" )<br />
   {<br />
      $return_data .= "numgames=".count($games[1])."\n";<br />
   } else if( $output === "array" )<br />
   {<br />
      $return_data['numgames'] = count($games[1]);<br />
   }</p>
<p>   #<br />
   #<br />
   #  Replace HTTP:// from urls for xml<br />
   $search_http  = array('http://','HTTP://');<br />
   $replace_http = array('');<br />
   $search_colon  = array(':','&#038;');<br />
   $replace_colon = array('-','and');<br />
   $users_games = array();</p>
<p>   $counter = 0;<br />
   $num = 0;</p>
<p>   if( $output === "array" )<br />
   {<br />
      $all_games = array();<br />
   }</p>
<p>   foreach ( $games[1] as $game )<br />
   {<br />
      $gametitle = str_replace( $search_colon, $replace_colon, html_entity_decode( $game ) );<br />
      $trophies_url = "http://profiles.us.playstation.com".$game_trophies[1][$num];<br />
      $completed = $game_completed[1][$num];<br />
      if( $output === "xml" )<br />
      {<br />
         $return_data .= "<game gametitle=\"".$gametitle."\" bronze=\"".$matches[1][$counter]."\" silver=\"".$matches[1][$counter+1]."\" gold=\"".$matches[1][$counter+2]."\" platinum=\"".$matches[1][$counter+3] ."\" game_image=\"".$game_icons[1][$num]."\" game_trophies=\"".$trophies_url."\"/>";<br />
         $num++;<br />
      } else if( $output === "key" )<br />
      {<br />
         $num++;<br />
         $return_data .= "name_". $num ."=". $gametitle."\n";<br />
         $return_data .= "bronze_". $num."=". $matches[1][$counter]."\n";<br />
         $return_data .= "silver_". $num."=". $matches[1][$counter+1]."\n";<br />
         $return_data .= "gold_". $num."=". $matches[1][$counter+2]."\n";<br />
         $return_data .= "platinum_". $num."=". $matches[1][$counter+3]."\n";<br />
         $return_data .= "image_". $num."=". $game_icons[1][$num-1]."\n";<br />
         $return_data .= "trophiesurl_". $num."=". $trophies_url."\n";<br />
      } else if( $output === "array" )<br />
      {<br />
         $num++;<br />
         $sub_game = array();<br />
         $sub_game['name'] = $gametitle;<br />
         $sub_game['gametitle'] = $gametitle;<br />
         $sub_game['bronze'] = $matches[1][$counter];<br />
         $sub_game['silver'] = $matches[1][$counter+1];<br />
         $sub_game['gold'] = $matches[1][$counter+2];<br />
         $sub_game['platinum'] = $matches[1][$counter+3];<br />
         $sub_game['image'] = $game_icons[1][$num-1];<br />
         $sub_game['trophiesurl'] = $trophies_url;<br />
         $sub_game['completed'] = $completed;<br />
         array_push( $all_games, $sub_game );<br />
      }<br />
      $counter+=4;<br />
   }<br />
   if( $debug ) print_r( $trophies );</p>
<p>   if( $output === "array" )<br />
   {<br />
      $return_data['games'] = $all_games;<br />
   }</p>
<p>   if( $output === "xml" )<br />
   {<br />
      $return_data.= "</spanclass></ahref></divclass></spanclass></psn>";<br />
      $return_data.= "</gamerdata>";<br />
   }<br />
   return $return_data;<br />
}</p>
<p> class mycurl {<br />
     protected $_useragent;<br />
     protected $_url;<br />
     protected $_followlocation;<br />
     protected $_timeout;<br />
     protected $_maxRedirects;<br />
     protected $_cookieFileLocation = './cookie.txt';<br />
     protected $_post;<br />
     protected $_postFields;<br />
     protected $_referer ="http://www.thegamecollective.co.uk";</p>
<p>     protected $_session;<br />
     protected $_webpage;<br />
     protected $_includeHeader;<br />
     protected $_noBody;<br />
     protected $_status;<br />
     protected $_binaryTransfer;<br />
     public    $authentication = 0;<br />
     public    $auth_name      = '';<br />
     public    $auth_pass      = '';</p>
<p>     public function useAuth($use){<br />
       $this->authentication = 0;<br />
       if($use == true) $this->authentication = 1;<br />
     }</p>
<p>     public function setName($name){<br />
       $this->auth_name = $name;<br />
     }<br />
     public function setPass($pass){<br />
       $this->auth_pass = $pass;<br />
     }</p>
<p>     public function __construct($url,$useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1",$followlocation = true,$timeOut = 30,$maxRedirecs = 4,$binaryTransfer = false,$includeHeader = false,$noBody = false)<br />
     {<br />
         $this->_url = $url;<br />
         $this->_followlocation = $followlocation;<br />
         $this->_timeout = $timeOut;<br />
         $this->_maxRedirects = $maxRedirecs;<br />
         $this->_noBody = $noBody;<br />
         $this->_includeHeader = $includeHeader;<br />
         $this->_binaryTransfer = $binaryTransfer;<br />
         $this->_useragent = $useragent;</p>
<p>         $this->_cookieFileLocation = dirname(__FILE__).'/cookie.txt';</p>
<p>     }</p>
<p>     public function setReferer($referer){<br />
       $this->_referer = $referer;<br />
     }</p>
<p>     public function setCookiFileLocation($path)<br />
     {<br />
         $this->_cookieFileLocation = $path;<br />
     }</p>
<p>     public function setPost ($postFields)<br />
     {<br />
        $this->_post = true;<br />
        $this->_postFields = $postFields;<br />
     }<br />
     public function setUserAgent($userAgent)<br />
     {<br />
         $this->_useragent = $userAgent;<br />
     }</p>
<p>     public function createCurl($url = 'nul')<br />
     {<br />
        if($url != 'nul'){<br />
          $this->_url = $url;<br />
        }</p>
<p>         $s = curl_init();</p>
<p>         curl_setopt($s,CURLOPT_URL,$this->_url);<br />
         curl_setopt($s,CURLOPT_HTTPHEADER,array('Expect:'));<br />
         curl_setopt($s,CURLOPT_TIMEOUT,$this->_timeout);<br />
         curl_setopt($s,CURLOPT_MAXREDIRS,$this->_maxRedirects);<br />
         curl_setopt($s,CURLOPT_RETURNTRANSFER,true);<br />
         curl_setopt($s,CURLOPT_FOLLOWLOCATION,$this->_followlocation);<br />
         curl_setopt($s,CURLOPT_COOKIEJAR,$this->_cookieFileLocation);<br />
         curl_setopt($s,CURLOPT_COOKIEFILE,$this->_cookieFileLocation);</p>
<p>         if($this->authentication == 1){<br />
           curl_setopt($s, CURLOPT_USERPWD, $this->auth_name.':'.$this->auth_pass);<br />
         }<br />
         if($this->_post)<br />
         {<br />
             curl_setopt($s,CURLOPT_POST,true);<br />
             curl_setopt($s,CURLOPT_POSTFIELDS,$this->_postFields);</p>
<p>         }</p>
<p>         if($this->_includeHeader)<br />
         {<br />
               curl_setopt($s,CURLOPT_HEADER,true);<br />
         }</p>
<p>         if($this->_noBody)<br />
         {<br />
             curl_setopt($s,CURLOPT_NOBODY,true);<br />
         }<br />
         /*<br />
         if($this->_binary)<br />
         {<br />
             curl_setopt($s,CURLOPT_BINARYTRANSFER,true);<br />
         }<br />
         */<br />
         curl_setopt($s,CURLOPT_USERAGENT,$this->_useragent);<br />
         curl_setopt($s,CURLOPT_REFERER,$this->_referer);</p>
<p>         $this->_webpage = curl_exec($s);<br />
                   $this->_status = curl_getinfo($s,CURLINFO_HTTP_CODE);<br />
         curl_close($s);</p>
<p>     }</p>
<p>   public function getHttpStatus()<br />
   {<br />
       return $this->_status;<br />
   }</p>
<p>   public function __tostring(){<br />
      return $this->_webpage;<br />
   }<br />
}<br />
?>
</p></div>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by aur8l</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-217</link>
		<dc:creator>aur8l</dc:creator>
		<pubDate>Mon, 18 Jan 2010 18:39:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-217</guid>
		<description>Sorry to revive this post from the depths of last year, but this php file is just what I need for my current devs. Is there any way to get my hands on this?
that would be so nice, and would save me some trouble.
thanks a lot.</description>
		<content:encoded><![CDATA[<p>Sorry to revive this post from the depths of last year, but this php file is just what I need for my current devs. Is there any way to get my hands on this?<br />
that would be so nice, and would save me some trouble.<br />
thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by mmmj</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-214</link>
		<dc:creator>mmmj</dc:creator>
		<pubDate>Wed, 13 Jan 2010 02:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-214</guid>
		<description>Would love to see the php for this?
Very neat!</description>
		<content:encoded><![CDATA[<p>Would love to see the php for this?<br />
Very neat!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by john</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-29</link>
		<dc:creator>john</dc:creator>
		<pubDate>Sun, 29 Nov 2009 13:26:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-29</guid>
		<description>&lt;a href=&quot;#comment-26&quot; rel=&quot;nofollow&quot;&gt;@Sy &lt;/a&gt; 
Wordstyle template? Nope, but it could be done! I&#039;d be happy to help with it...</description>
		<content:encoded><![CDATA[<p><a href="#comment-26" rel="nofollow">@Sy </a><br />
Wordstyle template? Nope, but it could be done! I&#8217;d be happy to help with it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by john</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-28</link>
		<dc:creator>john</dc:creator>
		<pubDate>Sun, 29 Nov 2009 13:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-28</guid>
		<description>&lt;a href=&quot;#comment-25&quot; rel=&quot;nofollow&quot;&gt;@Sy &lt;/a&gt; 
Hi Sy, thanks  for your comment! Do you know how to program in PHP? If you do, you could parse the results and then use these in the page you speak of. If you need more info, let me know.</description>
		<content:encoded><![CDATA[<p><a href="#comment-25" rel="nofollow">@Sy </a><br />
Hi Sy, thanks  for your comment! Do you know how to program in PHP? If you do, you could parse the results and then use these in the page you speak of. If you need more info, let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on PlayStation 3 Trophies API by Eivind teig</title>
		<link>http://blog.thegamecollective.co.uk/?p=72&#038;cpage=1#comment-27</link>
		<dc:creator>Eivind teig</dc:creator>
		<pubDate>Sat, 28 Nov 2009 23:58:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.thegamecollective.co.uk/?p=72#comment-27</guid>
		<description>Brilliant, just the thing i was looking for :)</description>
		<content:encoded><![CDATA[<p>Brilliant, just the thing i was looking for <img src='http://blog.thegamecollective.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
