Ho un problema con le api googleAnalytics. In locale tutto ok, in remoto no!
A volte estrae i dati e a volte no! L'unico messaggio di errore è questo (un warning):
DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input
questa è la funzione che genera l'errore (non è mia ma è una libreria di Google scaricata):
codice:
public function getDataResult() {
$data = array();
$xml = GoogleAnalyticsApi::getPage($this->generateQuery(), $this->auth);
if(is_integer($xml)) {
$this->errorCode = $xml;
return false;
}
$dom = new DOMDocument();
$dom->loadXML($xml);
$entries = $dom->getElementsByTagName("entry");
foreach($entries as $entry) {
$objEntry = new Entry();
$dimension = $entry->getElementsByTagName("dimension");
foreach ($dimension as $d) {
$objEntry->addProperty($d->getAttribute("name"),$d->getAttribute("value"));
}
$metric = $entry->getElementsByTagName("metric");
foreach ($metric as $m) {
$objEntry->addProperty($m->getAttribute("name"),$m->getAttribute("value"));
}
array_push($data, $objEntry);
}
return $data;
}
public function getXmlResult() {
return GoogleAnalyticsApi::getPage($this->generateQuery(), $this->auth);
}
}
L'errore dovrebbe nascere nel terzo rigo.. avete idee!?!? (in locale funziona sempre!) Il sito gira su altervista!