[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vps-mail] Installing new Perl modules - solved!



Mon, 22 Dec 2003 13:48:07 +0100 scripsit Marjolein Katsma:

> I'm working on a site (on an off, when I have time) where I have a need to
> present Whois data for certain IP number and domains.

Marjolein,

You might have been making life unnecessarily complicated for your self.

Log in to your VPS and find out if there is already a whois implementation:

~ which whois
/usr/local/bin/whois

If there is, then you can invoke it directly in a PHP script. Here's the
source of a page on one of my sites which uses precisely this (with
irrelevent stuff snipped out):

<?php

  $lookup = trim($HTTP_POST_VARS['lookup']);
  if ( strlen($lookup) )
    $can_lookup = preg_match("/^[\w\d][\w\.\d-]+$/",$lookup);

?>

<form method="post" action="<?= $PHP_SELF ?>">

Enter a domain name, RIPE/ARIN/APNIC/LACNIC handle or IP address:<br><br>
<input type="text" size="30" name="lookup" value="<?= htmlentities($lookup) ?>">&nbsp;
<input type="submit" value="Lookup">

</form>

<br><br>

<?php

  if ( strlen($lookup) ) {

    if ( $can_lookup ) {
      echo "<pre>";
      passthru("/usr/local/bin/whois $lookup");
      echo "</pre>\n";
    }
      else

      echo "<b>The data you entered is invalid and can't be used to perform a whois lookup.</b>";
  }

?>



-- 
G. Stewart   --   gstewart@xxxxxxxxxxx -- gstewart@xxxxxxxxxxx
Registered Linux user #284683 (Slackware 9.0, Linux 2.6.0)
--------------------------------------------------------------
Male cadavers are incapable of yielding testimony.
======================================================================
This is <vps-mail@xxxxxxxxxxxx>       <http://www.perlcode.org/lists/>
Before posting a question, please search the archives (see above URL).


Main Index | Thread Index
Match: Format: Sort by:
Search: