protected function formatUrl($scope, $name, $opts, $truncateKey = true)
    {
        // create url
        $url = Config::getInstance()->api_base.$scope.'/'.$name.'.xml.aspx';

        // truncacte apikey for log safety
        if ($truncateKey && count($opts)) {
            if (isset($opts['apikey'])) {
                $opts['apikey'] = substr($opts['apikey'], 0, 16).'...';
            }
            if (isset($opts['vCode'])) {
                $opts['vCode'] = substr($opts['vCode'], 0, 16).'...';
            }
        }

        // add post data
        if (Config::getInstance()->http_post) {
            $url .= ' DATA: '.http_build_query($opts, '', '&');
        } elseif (count($opts)) { // add data to url
            $url .= '?'.http_build_query($opts, '', '&');
        }

        return $url;
    }