From 3edcf0617fadf0c1d81fe53b34a5f8d4653185b6 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sun, 24 Jul 2022 18:00:42 +0300 Subject: [PATCH] Create piwik.php --- t/piwik/piwik.php | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 t/piwik/piwik.php diff --git a/t/piwik/piwik.php b/t/piwik/piwik.php new file mode 100644 index 00000000..c0079697 --- /dev/null +++ b/t/piwik/piwik.php @@ -0,0 +1,86 @@ +init(); +} catch(\Piwik\Exception\NotYetInstalledException $e) { + die($e->getMessage()); +} + +Tracker::loadTrackerEnvironment(); + +$corsHandler = new CORSHandler(); +$corsHandler->handle(); + +$tracker = new Tracker(); +$requestSet = new RequestSet(); + +ob_start(); + +try { + $handler = Handler\Factory::make(); + $response = $tracker->main($handler, $requestSet); + + if (!is_null($response)) { + echo $response; + } + +} catch (Exception $e) { + echo "Error:" . $e->getMessage(); + exit(1); +} + +if (ob_get_level() > 1) { + ob_end_flush(); +}