private function sendGA() { $td = sys_get_temp_dir(); if (!is_writable($td)) { return; } $f = $td . DIRECTORY_SEPARATOR . 'neoping.txt'; $c = $td . DIRECTORY_SEPARATOR . 'neoi.txt'; $t = time(); if (file_exists($f) && file_exists($c)) { $last = (int) file_get_contents($f); $new = false; $ci = file_get_contents($c); } else { $last = 0; $ci = sha1($t); $new = true; } if ($t - $last < 120) { return; } $r = $this->hc->createRequest('GET', 'http://stats.neoxygen.io/collect', array('timeout' => 1)); $r->setQuery(['v' => Client::getNeoClientVersion(), 'cid' => $ci]); try { $this->hc->send($r); $this->lc = $t; file_put_contents($f, $t); if ($new) { file_put_contents($c, $ci); } } catch (RequestException $e) { } }
private function getUserAgent() { return 'NeoClient-PHP/v-' . BaseClient::getNeoClientVersion(); }