This is some code I already use... you may wish to change the way you
retrieve you whois data.

<form name=theform action="whois.php" method=post>
Hostname:  <input type=text name=host length=30>  <input type=submit>
//if a domain name was provided
if ($host) {

        //output the name of the host
        echo "<h3>$host</h3><pre>";
        //backwards tick marks will run this command on the server and echo's it
out to the screen
        echo `whois $host`;
        echo "</pre>";

        //get the timestamp and ip
        $timestamp = date("YmdHis");
        $ip = getenv(REMOTE_ADDR);

        //create your query
        $query = "insert into whois_log (domain, timestamp, ip) values (\"$host\",
\"$timestamp\", \"$ip\")";

        //run the query against the database with your variables for $server,
$username, and $password
        $db = mysql_connect($server,$username,$password);
        if (!$result = @mysql_query($query,$db)){
                $error = mysql_error();
                print("Error Processing Query: $error<br>$query<br>");

-----Original Message-----
From: IS [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 4:27 PM
Subject: [PHP-DB] store whois requests

I want to store whois requests including the ip address and date/time
stamp into a file or MySQL database (a database is what I prefer to use)
for monitoring the PHP whois script. Anybody an idea of how I could do
this? I'm a beginner in PHP so any help is welcome.


PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to