You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that calling the API in PHP is still partly broken.
Using the code provided in http://developer.piwik.org/guides/querying-the-reporting-api results in a piece of code that changes the default timezone to UTC. In other words, using Piwik as documented will force the calling code to use UTC as a default timezone. This behaviour is intrusive and not documented. I'll see if I can edit the wiki later.
Moreover, the code sample mentions: // 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"
Clearly, this is not sufficient. Doing so will result in the following: PHP Fatal error: Class 'Piwik\\Application\\Environment' not found in <path>
This part of the documentation cannot be edited via the wiki.
As a result, there still seems to be no clean way of using the API directly in PHP.
The text was updated successfully, but these errors were encountered:
Apparently, the "correct" way to include the API would be:
require_oncePIWIK_INCLUDE_PATH . "/libs/upgradephp/upgrade.php";
require_oncePIWIK_INCLUDE_PATH . "/core/API/Request.php";
// Additional includes missing from documentationrequire_oncePIWIK_INCLUDE_PATH . '/vendor/autoload.php';
This is for 2.14.2 ; 2.14.1 still appears to have the old core/Loader.php (which for some reason does not get deleted when upgrading from 1.x, but that's another issue and frankly, I'm too annoyed to create another one for now)
Thanks for feedback @LeCoyote. I removed the outdated comment in 6d86b4d.
When I try the code in developer doc, it works for me. if you still have a problem please create a new issue and put your whole test code we can use to reproduce the issue
Ref: #3921
It seems that calling the API in PHP is still partly broken.
Using the code provided in http://developer.piwik.org/guides/querying-the-reporting-api results in a piece of code that changes the default timezone to UTC. In other words, using Piwik as documented will force the calling code to use UTC as a default timezone. This behaviour is intrusive and not documented. I'll see if I can edit the wiki later.
Moreover, the code sample mentions:
// 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"
Clearly, this is not sufficient. Doing so will result in the following:
PHP Fatal error: Class 'Piwik\\Application\\Environment' not found in <path>
This part of the documentation cannot be edited via the wiki.
As a result, there still seems to be no clean way of using the API directly in PHP.
The text was updated successfully, but these errors were encountered: