Top

Name

http_client_ip — Returns the IP address of the calling client.

Synopsis

varchar http_client_ip ( in what integer );
 

Description

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.

Parameters

what

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.

Examples

Example 24.155. Obtaining the Client IP Address

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