Displaying XML Data Stored in a PHP Variable
I'm currently trying to pull data from the Playstation 3's PSN API and I'm not entirely sure what I'm doing.
Here is my code, saved as trophycount.php.
Here it is online. If you view the source you will see that the XML is being returned.
$url = "http://www.psnapi.com.ar/ps3/api/psn.asmx/getPSNID";
$username = "vlastanovak";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_POSTFIELDS, "sPSNID=$username");
$data = curl_exec($ch);
How can I display specific data from the XML feed?
Also, when I change the echo $data line to return $data, the source becomes blank?
Thanks in advance!