Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP API is not set to follow HTTP redirects #12571

Closed
olleharstedt opened this issue Feb 20, 2018 · 6 comments
Closed

PHP API is not set to follow HTTP redirects #12571

olleharstedt opened this issue Feb 20, 2018 · 6 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@olleharstedt
Copy link

olleharstedt commented Feb 20, 2018

This setting

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

needs to be set in the PHP API, in case an HTTP request is being redirected to HTTPS.

@sgiehl
Copy link
Member

sgiehl commented Feb 20, 2018

What problem are you trying to solve?

@olleharstedt
Copy link
Author

olleharstedt commented Feb 20, 2018

When using the PHP API, we set it up like

PiwikTracker::$URL = 'http://piwik.oursite.org';
$piwikTracker = new PiwikTracker($siteId = 1);

If HTTP redirects to HTTPS, it will fail silently. Which is bad. It should either:

  1. Throw an exception or return false or something like that;
  2. Or follow the redirect.

@olleharstedt
Copy link
Author

By which I mean, this call should return false:

 $result = $piwikTracker->doTrackGoal(20, 1);

@tsteur
Copy link
Member

tsteur commented Feb 20, 2018

Sounds like this is actually an issue for https://github.com/matomo-org/matomo-php-tracker/ . Do you mind creating a PR there?

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Feb 20, 2018
@olleharstedt
Copy link
Author

Done.

@sgiehl
Copy link
Member

sgiehl commented Feb 21, 2018

Thanks. I'll close the issue here in favor of matomo-org/matomo-php-tracker#31

@sgiehl sgiehl closed this as completed Feb 21, 2018
@sgiehl sgiehl added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

3 participants