protected function qsencode(array $data = array()) {
        $req = '';
        
        if ($data) {
            foreach ($data as $key => $value) {
                $req .= $key . '=' . urlencode(stripslashes($value)) . '&';
            }
            $req = substr($req, 0, strlen($req) - 1); // Cut the last '&'
        }
        
        return $req;
    }