Custom IP resolving

Top  Previous  Next

Professional edition only

 

In Options window on Network page you can define custom URL that will be checked prior to regular IP to domain name resolving. It can be used by team members who want to share manually edited host names with each other.

 

The script on your web server should comply to precise but simple rules. To the URL you define in Options window, Web Log Storming will add parameters that your script should respond to.

 

cmd

Command that should be execute. Possible values: get or set.

ip

IP address

domain

Domain name (only if command is set)

 

In other words, if you define this as URL:

 

       http://mydomain.com/resolveip.php

 

It will be used as:

 

       http://mydomain.com/resolveip.php?cmd=get&ip=1.2.3.4

 

or

 

       http://mydomain.com/resolveip.php?cmd=set&ip=1.2.3.4&domain=John

 

Return values

For get command, the script should just return domain name and nothing else. If not found, it should return empty text.

 

For set command, the script should write ip/domain pair into database (or whatever means you decide to use) and return "OK" if successful.

 

 

Example

Here is a simple example in php.

 

<?php

 

// first, we get cmd and ip from parameters

$cmd = $_GET['cmd'];

$ip = $_GET['ip'];

 

// then we check cmd

if ($cmd == 'get') {

 

       // for 'get' command, we find $ip in database

       // by using custom find_ip() function...

       $domain = find_ip($ip);

 

       // ...and write the result to output

       echo $domain;

 

} elseif ($cmd = 'set') {

 

       // for 'set' command, we find read 'domain' parameter...

       $domain = $_GET['ip'];

       

       // and call a function to write a pair into database

       if (write_ip($ip, $domain)) {

               echo "OK";

       } else {

               echo "Error";

       }

 

}

 

?>