eyecatchup / SEOstats

SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.
MIT License
1.46k stars 383 forks source link

MozScape.php api endpoint should pass full url -- not just root domain #116

Open JordanMagnuson opened 8 years ago

JordanMagnuson commented 8 years ago

In the getCols() function within Services/Mozscape.php, the passed url is stripped to its root domain before being sent to Mozscape:

    $apiEndpoint = sprintf(Config\Services::MOZSCAPE_API_URL,
        urlencode(Helper\Url::parseHost(parent::getUrl($url))),
        $cols,
        Config\ApiKeys::MOZSCAPE_ACCESS_ID,
        $expires,
        urlencode(self::_getUrlSafeSignature($expires))
    );

This makes it impossible to get stats for a particular subpage of a website (for example: example.com/some/page).

Should be changed to:

    $apiEndpoint = sprintf(Config\Services::MOZSCAPE_API_URL,
        urlencode(parent::getUrl($url)),
        $cols,
        Config\ApiKeys::MOZSCAPE_ACCESS_ID,
        $expires,
        urlencode(self::_getUrlSafeSignature($expires))
    );