Gather information from another website

I want to extract information from playstation website to use on my forums for VBulletin.

For example
Public Trophies - PlayStation.com

I want to extract the level (35) and number of trophies (7861) and use them on my forums, in my postbit. I make VBulletin modifications, and know some php, but dealing with another website confuses me, and I’d like to learn more.

If Playstation had an API, I would use it, but unfortunately they don’t. This website can do it somehow, and I would like to learn how.
PS3/PSN Trophy Leaderboard - PS3Trophies

I was actually typing up a small tutorial on doing this, when I realised I couldn’t find the proper page url. Using the url you provided doesn’t work, because the actual content is iframed, however I think they are protecting the iframed content (maybe specifically to prevent what you are trying to do).

If someone can provide the direct page url that contains the information I can tell you how to extract it.

However, It’s unlikely that nobody has written an API for the Playstation Network yet so I’d recommend just googling for one :slight_smile:

That could explain why my code doesn’t work. Mine still posting a lil tutorial, I’m still kinda curious on how it would work.

<?php
$source = file_get_contents("http://us.playstation.com/publictrophy/index.htm?onlinename=Roughdawg4");
if ($source = file_get_contents("http://us.playstation.com/publictrophy/index.htm?onlinename=Roughdawg4")) {
  $search = "[!--Start Text--]";
  $newText = substr($source,strpos($source, $search)+strlen($search), 100);
  echo $newText;
} else {
null
}
?>

i find that too!:rofl:

They’re using AJAX to obfuscate the data.
Try pulling
http://us.playstation.com/playstation/psn/profile/Roughdawg4/get_ordered_trophies_data
through a DOMDocument reader set up to interpret the stacked div’s.

NOTE: They also seem to be obfuscating this by preventing reading of the data after a few seconds of the initial page being called. You might have to cURL the original address, then the direct address in order to retrieve the data before their server cuts you off.

That said, this is starting to wander into the ‘You shouldnt be doing this’ region of coding, being that PSN are trying oh so hard to prevent you from doing this, its a general indication that this is NOT acceptable usage of their website.

Ah, so it’s you guys that crashed PSN!?

:stuck_out_tongue: