Services_Hoptoad::request_uri PHP Method

request_uri() public method

get the request uri
Author: Scott Woods
public request_uri ( ) : string
return string
    function request_uri()
    {
        if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
            $protocol = 'https';
        } else {
            $protocol = 'http';
        }
        $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
        $path = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
        $query_string = isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '';
        return "{$protocol}://{$host}{$path}{$query_string}";
    }