http_client_ip — Returns the IP address of the calling client.


varchar http_client_ip ( in what integer );


This function is used to determine the IP address or DNS name of the calling client.

Please note that this function is slow when resolving a DNS names. It is advisable to use IP addresses to to make applications faster.



a flag designating what to return:

0 - (default) : IP number of a client
1 - DNS name if it can be resolved; if no reverse DNS record can be found then the IP number will be returned.

Return Types

By default, a string of the dotted IP address of the client user agent. If what=1 then the DNS name will be returned.


Example24.155.Obtaining the Client IP Address

    declare ip varchar;
    ip := http_client_ip ();
    http (sprintf ('<p>Your IP address is: %s</p>', ip));