Jump to content

Accessing the Matomo Server with WGET


iwato

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: 

<?php
	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);
	error_reporting(E_ALL);
	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,

Quote

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?

Roddy

 

 

 

 

 

 

 

 

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...