0
我想寫一些PHP從Piwik中提取數據。目前我所要做的就是讓它運行示例代碼,但我不能。我在一個目錄下名爲分析安裝了它,我的代碼是Piwik API集成
<?php
use Piwik\API\Request;
use Piwik\FrontController;
echo "result script loaded";
define('PIWIK_INCLUDE_PATH', realpath('../../')."/httpdocs/analytics/");
define('PIWIK_USER_PATH', realpath('../../'."/httpdocs/analytics/"));
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
echo "<br/>1 PIWIK_INCLUDE_PATH: ".PIWIK_INCLUDE_PATH;
// if you prefer not to include 'index.php', you must also define here PIWIK_DOCUMENT_ROOT
// and include "libs/upgradephp/upgrade.php" and "core/Loader.php"
require_once PIWIK_INCLUDE_PATH . "index.php";
require_once PIWIK_INCLUDE_PATH . "core/API/Request.php";
FrontController::getInstance()->init();
// This inits the API Request with the specified parameters
$request = new Request('
module=API
&method=Resolution.getResolution
&idSite=all
&date=last4
&period=month
&format=XML
&filter_limit=3
&token_auth=anonymous
');
// Calls the API and fetch XML data back
echo "<br/>here";
$result = $request->process();
echo $result;
?>
這將運行,但產生
此頁面包含以下錯誤:第1欄第1行
錯誤:文件空 下面是頁面渲染到第一個錯誤。
所以它工作一點但不完全。我找不到任何東西來幫助我,所以如果您有任何想法,我會很感激
感謝
感謝偉大的工作 – user1616338