salve sto implementando le api di google analytics sul mio pannello di controllo:
codice PHP:
Codice PHP:
require_once("../include/db.php");
$QuerySts=mysql_query("SELECT * FROM statics") or die (mysql_error());
$ga_email=mysql_result($QuerySts,0,1);
$ga_password=mysql_result($QuerySts,0,2);
$ga_profile_id=mysql_result($QuerySts,0,3);
mysql_free_result($QuerySts);
//estrai-dati.php
define('ga_email','$ga_email');
define('ga_password','$ga_password');
define('ga_profile_id','$ga_profile_id'); //solo numeri!
require("../gapi.class.php");
$ga = new gapi(ga_email,ga_password); //accesso
//una sorta di "query"
$ga->requestAccountData();
//per ogni risultato scrivi il profilo attivo sull'account
foreach($ga->getResults() as $result)
{
echo $result . ' (' . $result->getProfileId() . ")<br />";
}
ma mi da questo errore:
Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. Error: "Request failed, fopen provides no further information"' in D:\SITI WEB\lavori\audit\gapi.class.php:418 Stack trace: #0 D:\SITI WEB\lavori\audit\gapi.class.php(62): gapi->authenticateUser('$ga_email', '$ga_password') #1 D:\SITI WEB\lavori\audit\statics\HelloAnalyticsApi.php(17) : gapi->__construct('$ga_email', '$ga_password') #2 {main} thrown in D:\SITI WEB\lavori\audit\gapi.class.php on line 418