Archive.php - can't pass https piwik url

Hello,

we cannot try new archive.php in piwik 1.6 as it seems to assume a http url. Because of security considerations we installed piwik in htdocs-ssl and just symlinked the files piwik.php and piwik.js where they are publicly accessible.

The following errors indicate that “http://” is prepended no matter I passed a complete url in the command line.


$ sudo -u www-data /usr/local/bin/php archive.php https://localhost/intern/piwik 7200
PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
[2011-12-22 09:39:09] [fac60ee0] [5.22 Mb] NOTE: in 'reset' mode, we will process all websites with visits in the last 7 Tage 0 Stunden
[2011-12-22 09:39:09] [fac60ee0] [5.30 Mb] ---------------------------
[2011-12-22 09:39:09] [fac60ee0] [5.30 Mb] INIT
[2011-12-22 09:39:09] [fac60ee0] [5.30 Mb] Querying Piwik API at: http://https://localhost/intern/piwik/index.php
[2011-12-22 09:39:09] [fac60ee0] [5.39 Mb] ERROR: Got invalid response from API request: http://https://localhost/intern/piwik/index.php?module=API&method=UsersManager.getTokenAuth&userLogin=admin&md5Password=7a38e64a1981ab8ea95e75cf3b8ddb05&format=php&serialize=0&trigger=archivephp. Response was 'curl_exec: Couldn't resolve host 'https:''
[2011-12-22 09:39:09] [fac60ee0] [5.39 Mb] ERROR: token_auth is expected to be 32 characters long. Got a different response ''
PHP Fatal error:  token_auth is expected to be 32 characters long. Got a different response '' in /.../archive.php on line 179

Fatal error: token_auth is expected to be 32 characters long. Got a different response '' in /.../archive.php on line 179

Would be glad if archive.php becomes more sensitive here. :slight_smile:

Suggestion: archive.php@L332

 /* wrap plain hostname and path */
$this->piwikUrl = strpos($_SERVER['argv'][1],'http') === 0 ? $_SERVER['argv'][1] : "http://{$_SERVER['argv'][1]}/index.php";

Regards,
HamsterDerwisch

There is a ticket about it: archive.php should allow the selection of https for curl (trunk) · Issue #2825 · matomo-org/matomo · GitHub