@LeCoyote opened this issue on May 2nd 2013

There are several undocumented issues when calling the API in PHP as described here: http://piwik.org/docs/analytics-api/calling-techniques/#toc-call-the-piwik-api-in-php - error_reporting is overwritten: piwik.php sets it to E_ALL|E_NOTICE - default timezone is overwritten: piwik.php sets it to UTC

These can apparently be alleviated by NOT including index.php, so perhaps it should be clearer in the documentation (ie. a small paragraph instead of just a couple of comments in the code sample).

Besides, in both cases : - calling Live.getCounters in PHP returns unexpected results. In this one instance where the site is running in the Europe/Paris timezone, if lastMinutes < 120, the API will always return 0 visits. This is obviously because the visits are stored in UTC and the calling code is 2 hours ahead of UTC (CEST). Apparently, this bug is undocumented and should definitely be handled by the API.

Last but not least, there is ticket #2294, on which I already commented: - when calling the API in PHP, the only usable format is 'original'; every other format will return a header that will, in turn, mess with the calling code's output. I must insist that this one should be considered a bug, not a feature request. Keywords: API

@mattab commented on May 5th 2013

I agree with lack of documentation, but really in this case best practise is for you to duplicate index.php and remove unwanted code, so you make your own custom boostrap. Our doc does not recommend this but I can recommend it. If you found a bug with Live API let us know in separate ticket.. thanks

@LeCoyote commented on May 6th 2013

If you acknowledge the lack of documentation, perhaps the bug should be left open until the documentation is fixed? A recommendation in a comment to a bug can hardly be considered documentation :)

And since you haven't commented on the other two issues, I'll take it they are genuine bugs. I will create a new one for the date problem and comment on #2294.

@anonymous-piwik-user commented on July 29th 2013

I've been asked to look in to why PiWik has been generation notices on our site, and I find the resolution to this bug to be very perplexing.

Is there any particular reason PiWik does not respect the logging setting configured in PHP? Is there really no other way to change this other than to edit PiWik's source? If there is a reason that the default is not used, could we at least modify it from a configuration setting, instead?

@mattab commented on July 29th 2013

If you have a patch/pull request, I will be pleased to look at it and consider it for inclusion in core. Thanks!

This issue was closed on July 29th 2013
Powered by GitHub Issue Mirror