In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Ok, now I am not sure why I cannot get this output into a variable so I can
> place it into a database table field.  Any help would be greatly
> appreciated.
> <?php
> 
> /* Check client info and register */
> if (getenv(HTTP_X_FORWARDED_FOR)){
>  $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
> } else {
>  $ipaddy = getenv(REMOTE_ADDR);
>  $host = gethostbyaddr($REMOTE_ADDR); }
> 
> /* Start looking up users IP vs. WHOIS database for logging */
> $nipaddy = "";
> function message($msg){
> echo "$msg";
> flush();
> }
> function arin($ipaddy){
> $server = "whois.arin.net";
> if (!$ipaddy = gethostbyname($ipaddy))
>   $msg .= "Can't IP Whois without an IP address.";
> else{
>   if (! $sock = fsockopen($server, 43, &$num, &$error, 20)){
>     unset($sock);
>     $msg .= "Timed-out connecting to $server (port 43)";
>     }
>   else{
>     fputs($sock, "$ipaddy\n");
>     while (!feof($sock))
>       $buffer .= fgets($sock, 10240);
>     fclose($sock);
>     }
>    if (eregi("RIPE.NET", $buffer))
>      $nextServer = "whois.ripe.net";
>    else if (eregi("whois.apnic.net", $buffer))
>      $nextServer = "whois.apnic.net";
>    else if (eregi("nic.ad.jp", $buffer)){
>      $nextServer = "whois.nic.ad.jp";
>      #/e suppresses Japanese character output from JPNIC
>      $extra = "/e";
>      }
>    else if (eregi("whois.registro.br", $buffer))
>      $nextServer = "whois.registro.br";
>    if($nextServer){
>      $buffer = "";
>      message("Deferred to specific whois server: $nextServer...<br><br>");
>      if(! $sock = fsockopen($nextServer, 43, &$num, &$error, 10)){
>        unset($sock);
>        $msg .= "Timed-out connecting to $nextServer (port 43)";

Hmm, seems your message is too long for my newsreader to include the lot. 
However, it seems that you may not be returning a value from the function 
arin(), so whan you do 

/* Place results into a var */
$whois = arin($ipaddy); // Right now if this is here it will show in two
areas of the screen

natuarally nothing is placed in $whois.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to