Request Class

    See the documentation for the IncomingRequest Class and for more usage details.

      • getIPAddress()

    Returns:The user’s IP Address, if it can be detected, or null. If the IP addressis not a valid IP address, then will return 0.0.0.0Return type:string

    Returns the IP address for the current user. If the IP address is not valid, the methodwill return ‘0.0.0.0’:

    Important

    This method takes into account the App->proxyIPs setting and willreturn the reported HTTP_X_FORWARDED_FOR, HTTP_CLIENT_IP, HTTP_X_CLIENT_IP, orHTTP_X_CLUSTER_CLIENT_IP address for the allowed IP address.

    1. - **$ip** (_string_) IP address
    2. - **$which** (_string_) IP protocol (‘ipv4 or ipv6’)Returns:

    true if the address is valid, false if notReturn type:bool

    Takes an IP address as input and returns true or false (boolean) dependingon whether it is valid or not.

    Note

    The $request->getIPAddress() method above automatically validates the IP address.

    Accepts an optional second string parameter of ‘ipv4’ or ‘ipv6’ to specifyan IP format. The default checks for both formats.

    • ([$upper = FALSE])

      HTTP request methodReturn type:string

      Returns the $_SERVER['REQUEST_METHOD'], with the option to set itin uppercase or lowercase.

      • getServer([$index = null[, $filter = null[, $flags = null]]])

      Parameters:

      1. - **$index** (_mixed_) Value name
      2. - **$filter** (_int_) The type of filter to apply. A list of filters can be found [here](http://php.net/manual/en/filter.filters.php).

      $_SERVER item value if found, NULL if notReturn type:mixed

      This method is identical to the post(), get() and cookie() methods from theIncomingRequest Class, only it fetches getServer data ($_SERVER):