VisualAppeal / Matomo-PHP-API

PHP wrapper for the Matomo API.
MIT License
95 stars 33 forks source link

addSite() doesn't work when $siteName has a space #5

Closed braseidon closed 10 years ago

braseidon commented 10 years ago

Hey there, awesome API wrapper! This saved me a TON of work, it's much appreciated.

This morning I came across a bug - When you use the API to add a site to Piwik (I'm building a large, multi-domain app), if the $siteName has a space in it, it breaks the URL that Curl posts to. I haven't done a pull request before, but literally all I did to fix it was add this in the _parseUrl() function, under $params:

$params = array(
    ...
) + $params;

Add after:

if(isset($params['siteName'])) $params['siteName'] = str_replace(' ', '%20', $params['siteName']);

Hope this helps someone! Cheers

thelfensdrfer commented 10 years ago

Great to hear! To contribute is not difficult. You have to fork the repository, clone your fork, commit and push your changes. After your changes are complete you visit your fork on github and you will find a button "create pull request"

https://help.github.com/articles/using-pull-requests

But i will try a different fix and urlencode all paremeters.