Jump to content

MrLee

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by MrLee

  1. Hi everyone, im looking for some help if anyone can offer it. I currently run a phpbb Playstation3 gaming forum and was looking for a way to show forum members online status info on a seperate page on my forum. I found some php script that pulls the freinds list data from the URL mentioned in the code, for now it only works on my local host and i get errors when trying to run it from my live server. here is the current code: <?php error_reporting(E_ALL); libxml_use_internal_errors(true); $fp = fopen("curl_log.txt",'a+'); //Logging purposes only $dataURL = "https://secure.eu.playstation.com/ajax/mypsn/friend/presence"; $loginURL = "https://store.playstation.com/external/login.action?returnURL=https://secure.eu.playstation.com/sign-in/confirmation"; $cc = curl_init(); getData(); function getData() { global $cc,$fp,$dataURL; curl_setopt ($cc, CURLOPT_URL, $dataURL); curl_setopt ($cc, CURLOPT_POST, 0); curl_setopt ($cc, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($cc, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($cc, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7'); curl_setopt ($cc, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($cc, CURLOPT_REFERER, $dataURL); curl_setopt ($cc, CURLOPT_VERBOSE, 1); curl_setopt ($cc, CURLOPT_STDERR, $fp); curl_setopt ($cc, CURLOPT_COOKIEFILE, 'cookie.txt'); $output = curl_exec($cc); $xml = simplexml_load_string($output); if (!$xml) { login(); } else { // Here you will have a simpleXML object that you can do with as you please - example output below. foreach($xml->psn_friend as $friend) { $img_loc = str_replace("//", "/", $friend->current_avatar); echo "<img src=\"https://secure.eu.playstation.com".$img_loc."\"/> "; echo "<font color=\"red\">$friend->onlineid</font> <br />"; echo "Status : ".$friend->current_presence."<BR />"; echo "Game : ".$friend->current_game."<BR />"; echo "Comment : ".$friend->Comment."<BR />"; echo "<BR /><BR />"; } curl_close($cc); fclose($fp); } } function login() { global $cc,$loginURL; curl_setopt ($cc, CURLOPT_URL, $loginURL); curl_setopt ($cc, CURLOPT_POST, 1); curl_setopt ($cc, CURLOPT_POSTFIELDS, 'loginName=<username@user.com>&password=<password>'); curl_setopt ($cc, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_exec($cc); getData(); } ?> The error i mentioned above is related to the curl_setopt ($cc, CURLOPT_FOLLOWLOCATION command, im not to concerned about that at the moment. Im looking for someone to help me with the actually XML object, its very basic and i would, if poss, love to have it looking like the actual PSN freinds list. Here are images of this codes output and the actuall Freinds list. Codes Ouput: Actuall PSN FR: Would it be possable to actually grab the exact image from the actuall playstation site, as above? or could the online/offline icons be added to the above code with a background image? I hope i have explained the above clearly, if theirs any thing anyone is unsure of please dont hesitate to ask. Hopefully someone can help. Thanks, Lee
  2. MrLee

    Hello

    Hi everyone, my names Lee and im from Glasgow I have very very limited knowledge of PHP but im keen to learn
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.