PHP Class Webiny\Component\Http\Request\Server

This class provide OO methods for accessing $_SERVER properties.
Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Exibir arquivo Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor
authType ( ) : string
documentRoot ( ) : string
gatewayInterface ( ) : string
get ( string $key ) : string
getAll ( )
httpAccept ( ) : string
httpAcceptCharset ( ) : string
httpAcceptEncoding ( ) : string
httpAcceptLanguage ( ) : string
httpClientIp ( ) : string
httpConnection ( ) : string
httpHost ( ) : string
httpReferer ( ) : string
httpUserAgent ( ) : string
httpXForwardedFor ( ) : string
https ( ) : string
origPathInfo ( ) : string
pathInfo ( ) : string
pathTranslated ( ) : string
phpAuthDigest ( ) : string
phpAuthPw ( ) : string
phpAuthUser ( ) : string
queryString ( ) : string
redirectRemoteUser ( ) : string
remoteAddress ( ) : string
remoteHost ( ) : string
remotePort ( ) : string
requestMethod ( ) : string
requestTime ( boolean $float = false ) : string
requestUri ( ) : string
scriptFilename ( ) : string
scriptName ( ) : string
serverAdmin ( ) : string
serverIpAddress ( ) : string
serverName ( ) : string
serverPort ( ) : string
serverProtocol ( ) : string
serverSignature ( ) : string
serverSoftware ( ) : string

Method Details

__construct() public method

Constructor
public __construct ( )

authType() public method

public authType ( ) : string
return string When doing HTTP authenticated this variable is set to the authentication type.

documentRoot() public method

public documentRoot ( ) : string
return string The document root directory under which the current script is executing, as defined in the server's configuration file.

gatewayInterface() public method

public gatewayInterface ( ) : string
return string What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.

get() public method

public get ( string $key ) : string
$key string $_SERVER key
return string

getAll() public method

public getAll ( )

httpAccept() public method

public httpAccept ( ) : string
return string Contents of the Accept: header from the current request, if there is one.

httpAcceptCharset() public method

public httpAcceptCharset ( ) : string
return string Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.

httpAcceptEncoding() public method

public httpAcceptEncoding ( ) : string
return string Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.

httpAcceptLanguage() public method

public httpAcceptLanguage ( ) : string
return string Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.

httpClientIp() public method

public httpClientIp ( ) : string
return string Clients' ip address. This date cannot be trusted if you are behind a reverse proxy. In that case you should first check for Server::httpXForwardedFor.

httpConnection() public method

public httpConnection ( ) : string
return string Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.

httpHost() public method

public httpHost ( ) : string
return string Contents of the Host: header from the current request, if there is one.

httpReferer() public method

public httpReferer ( ) : string
return string The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

httpUserAgent() public method

public httpUserAgent ( ) : string
return string Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.

httpXForwardedFor() public method

public httpXForwardedFor ( ) : string
return string Check for clients ip behind a reverse proxy.

https() public method

public https ( ) : string
return string Set to a non-empty value if the script was queried through the HTTPS protocol. NOTE: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.

origPathInfo() public method

public origPathInfo ( ) : string
return string Original version of 'PATH_INFO' before processed by PHP.

pathInfo() public method

public pathInfo ( ) : string
return string Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO'] would contain /some/stuff.

pathTranslated() public method

public pathTranslated ( ) : string
return string Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.

phpAuthDigest() public method

public phpAuthDigest ( ) : string
return string When doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation).

phpAuthPw() public method

public phpAuthPw ( ) : string
return string When doing HTTP authentication this variable is set to the password provided by the user.

phpAuthUser() public method

public phpAuthUser ( ) : string
return string When doing HTTP authentication this variable is set to the username provided by the user.

queryString() public method

public queryString ( ) : string
return string The query string, if any, via which the page was accessed.

redirectRemoteUser() public method

public redirectRemoteUser ( ) : string
return string The authenticated user if the request is internally redirected.

remoteAddress() public method

public remoteAddress ( ) : string
return string The IP address from which the user is viewing the current page.

remoteHost() public method

public remoteHost ( ) : string
return string The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.

remotePort() public method

public remotePort ( ) : string
return string The port being used on the user's machine to communicate with the web server.

requestMethod() public method

public requestMethod ( ) : string
return string Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'. NOTE: PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD.

requestTime() public method

public requestTime ( boolean $float = false ) : string
$float boolean Microsecond precision or not.
return string The timestamp of the start of the request.

requestUri() public method

public requestUri ( ) : string
return string The URI which was given in order to access this page; for instance, '/index.html'.

scriptFilename() public method

public scriptFilename ( ) : string
return string The absolute pathname of the currently executing script. Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.

scriptName() public method

public scriptName ( ) : string
return string Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.

serverAdmin() public method

public serverAdmin ( ) : string
return string The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host.

serverIpAddress() public method

public serverIpAddress ( ) : string
return string The IP address of the server under which the current script is executing.

serverName() public method

public serverName ( ) : string
return string The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.

serverPort() public method

public serverPort ( ) : string
return string The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. Note: Under the Apache 2, you must set UseCanonicalName = On, as well as UseCanonicalPhysicalPort = On in order to get the physical (real) port, otherwise, this value can be spoofed and it may or may not return the physical port value. It is not safe to rely on this value in security-dependent contexts.

serverProtocol() public method

public serverProtocol ( ) : string
return string Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';

serverSignature() public method

public serverSignature ( ) : string
return string String containing the server version and virtual host name which are added to server-generated pages, if enabled.

serverSoftware() public method

public serverSoftware ( ) : string
return string Server identification string, given in the headers when responding to requests.