Si, stavo provando a fare qualcosa...
Ho trovato questo sempre dallo stesso sito da cui ho preso lo script VB.NET:
Codice PHP:
<?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 (Windows; U; Windows NT 5.1; it; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');
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)
{
echo "Name : ".$friend->onlineid."
";
echo "Status : ".$friend->current_presence."
";
echo "Game : ".$friend->current_game."
";
echo "Comment : ".$friend->Comment."
";
echo "
";
}
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=xxxxx&password=xxxxx');
curl_setopt ($cc, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_exec($cc);
getData();
}
?>
Ma su atervista non gira, mi dice:
codice:
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /membri/simonemiraglia/psnAPI/home.php on line 25
E poi non ho ancora capito bene cosa mettere su "cookie.txt".
Mi devo informare meglio.
Comunque grazie.
CIAO