public static function arrayToUrlParams($params, $delimiter = '&')
    {
        $url_params = array();
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $subvalue) {
                    $url_params[] = urlencode($key) . '=' . urlencode($subvalue);
                }
            } else {
                $url_params[] = urlencode($key) . '=' . urlencode($value);
            }
        }
        return implode($delimiter, $url_params);
    }