Welcome Guest, Not a member yet? Register   Sign In
nuSOAP with Nice URL's
#1

[eluser]Unknown[/eluser]
Hello Forum!

I looked around and didn't find many solutions to being able to use nuSOAP with CI, and any solutions that I did find where a bit to disastrous to try and implement quickly.

Well I have devised a quick way of allowing nuSOAP to work with CI, only if you do not use GET input and instead use Nice URL's.

What you do is stop CI from processing GET input in the URI Library.
To do this open the URI.php file found in "System"->"Libraries", find the function "_fetch_uri_string()" and comment out the areas which process GET. Nothing else needs to be changed from the default state of CI (AFAIK).

Please let me know if there is any problems as I have not fully tested this method and I need to make sure everything works for my Licensing API.

If you are unsure of what to do just replace the entire function with the code below:

Code:
// --------------------------------------------------------------------

    /**
     * Get the URI String
     *
     * @access    private
     * @return    string
     */
    function _fetch_uri_string()
    {
        if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
        {
            //
            // [!] NOTE [!] When using nuSOAP we must let all GET input go untouched
            //
            // If the URL has a question mark then it's simplest to just
            // build the URI string from the zero index of the $_GET array.
            // This avoids having to deal with $_SERVER variables, which
            // can be unreliable in some environments
            /*if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')
            {
                $this->uri_string = key($_GET);
                return;
            }*/

            // Is there a PATH_INFO variable?
            // Note: some servers seem to have trouble with getenv() so we'll test it two ways
            $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
            if (trim($path, '/') != '' && $path != "/".SELF)
            {
                $this->uri_string = $path;
                return;
            }
            
            //
            // [!] NOTE [!] When using nuSOAP we must let all GET input go untouched
            //
            // No PATH_INFO?... What about QUERY_STRING?
            /*$path =  (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
            if (trim($path, '/') != '')
            {
                $this->uri_string = $path;
                return;
            }*/

            // No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
            $path = str_replace($_SERVER['SCRIPT_NAME'], '', (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO'));
            if (trim($path, '/') != '' && $path != "/".SELF)
            {
                // remove path and script information so we have good URI data
                $this->uri_string = $path;
                return;
            }

            // We've exhausted all our options...
            $this->uri_string = '';
        }
        else
        {
            $uri = strtoupper($this->config->item('uri_protocol'));

            if ($uri == 'REQUEST_URI')
            {
                $this->uri_string = $this->_parse_request_uri();
                return;
            }
            
            if ($uri != 'QUERY_STRING')
            {
                $this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
            }
        }

        // If the URI contains only a slash we'll kill it
        if ($this->uri_string == '/')
        {
            $this->uri_string = '';
        }
    }

    // --------------------------------------------------------------------




Theme © iAndrew 2016 - Forum software by © MyBB