Jump to content

Accessing the Matomo Server with WGET

Recommended Posts

BACKGROUND:  Having upgraded my server I now have full command of the UNIX terminal.  Although a good thing, my first attempt to make use of it has failed.  The following code was used to access the Matomo application which resides on the same Lunarpages VPS server as the PHP routine that calls it -- albeit from a different domain name.

The CODE: 

	ini_set('log_errors', 1);
	ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log');
	ini_set('html_errors', 0);
	ini_set('display_errors', 0);
	exec('wget --http-user=[...] --http-password=[...] -P /tmp/ -p -k https://.../index.php?module=Widgetize&action=iframe&containerId=GoalsOverview&widget=1&moduleToWidgetize=CoreHome&actionToWidgetize=renderWidgetContainer&idSite=1&period=day&date=yesterday&disableLink=1&widget=1&token_auth=[...]');

When I examine the Response panel in the Network Menu of Firefox, nothing appears.  This said PHP does not complain and the Headers panel returns an HTTP Request code of 200.  When I run the same wget command in terminal I am able to generate an HTML file, but the contents tells me that the Matomo API responsible for generating the desired widget is not accessible.  The error message reads,


The requested website idSite is not found in the request, or is invalid.   Please check that you are logged in Matomo and have permission to access the specified website

Any suggestions?










Share this post

Link to post
Share on other sites

When I examine the Response panel in the Network Menu of Firefox, nothing appears.

Why would anything appear?

If Matomo thinks you're not authenticated then you need to figure out why.  I don't know if token_auth is for authentication or authorization, but when you log in through a browser it will set various cookies and things.

It looks like you're trying to use HTTP authentication, so make sure that Matomo supports that.  HTTP authentication is not the same thing as, for example, a username and password form on a web page.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...