printDebug() error

Hello,

Hope someone can help. Searched the website but cant seem find a solution.

Not sure what im doing wrong but ive set up Piwik and its all fine when using the login system. However im now trying to call the Piwik api in PHP and it keeps throwing the error:

Fatal error: Call to undefined function printDebug() in /home/xx/public_html/piwik/core/Tracker/Action.php on line 190

Im using the following code:


	define('PIWIK_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/piwik');
	define('PIWIK_USER_PATH', $_SERVER['DOCUMENT_ROOT'] . '/piwik');
	define('PIWIK_INCLUDE_PATH', $_SERVER['DOCUMENT_ROOT'] . '/piwik');
	define('PIWIK_ENABLE_DISPATCH', false);
	define('PIWIK_ENABLE_ERROR_HANDLER', false);
	define('PIWIK_ENABLE_SESSION_START', false);

	require_once(PIWIK_INCLUDE_PATH . "/libs/upgradephp/upgrade.php" );
	require_once(PIWIK_INCLUDE_PATH . "/core/Loader.php" );
	require_once(PIWIK_INCLUDE_PATH . "/core/API/Request.php" );

	//Piwik Analytics 
	Piwik_FrontController::getInstance()->init();

	//query request
	$request = new Piwik_API_Request('
				method=Actions.getPageUrl
				&pageUrl=/releases.php?id=123456
				&idSite=1
				&date=today
				&period=month
				&format=php
				&token_auth=xxxxxxxxxxxxxxxxxxxx
	');
	// Calls the API and fetch data back
	$pageStats = $request->process();

Any help would be appreciated and thanks for reading.

fl3x7

Thats strange. The page running the Piwik_API_Request was continually throwing the above error. At this stage the analytics JavaScript had not logged anything as the page had not been visited(yet).

Then as soon as I visited the page with the JavaScript on, and went back to my Piwik_API_Request page, it loaded. However it is now intermittent. It loads the request. Then if I hit refresh within the next couple of seconds I get the same printDebug error. if I then wait about 30 seconds to a minute and try again the page loads again and then errors again etc etc.

Hope someone can help :slight_smile: . Really looking forward to getting this working on a project im working on.

thanks for the report. I think this is a bug indeed!

to work around it, please add the following code

function printDebug($t) { echo $t; }

then refresht he page. Can you please copy paste here the error or message displayed then ?

Thanks