How To Get Remote_host?

liunx

Guest
I did a <?php echo $_SERVER['REMOTE_HOST'] ?>. Returns empty.<br /><br />Then I copied an example from PHP manual:<br /><?php<br />$headers = apache_request_headers();<br /><br />foreach ($headers as $header => $value) {<br /> echo "$header: $value <br />\n";<br />}<br />?><br /><br />no REMOTE_HOST line. no Remote_ADDR line.<br /><br />How does the PHP_INFO list REMOTE_HOST? <br /><br />By the way, can I check REMOTE_HOST in .htaccess RewriteCond?<!--content-->
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><?php<br />$a=$HTTP_SERVER_VARS;<br />foreach($a as $key=>$val)<br />{<br />print("$key=>$val<br>");<br />}<br />?><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Will show you everything you want... pick the variable that interests you most.<!--content-->
Thanks for the code. I got REMOTE_ADDR, but not REMOTE_HOST. OTOH, the <br /><br /><a href="http://www.totalchoicehosting.com/help/info.php" target="_blank">http://www.totalchoicehosting.com/help/info.php</a><br /><br />correctly listed my REMOTE_HOST under Apache Environment. How is it possible?<br /><br /><br />An unrelated question. I have turned on notifications, and set the correct email address. However, I never got any notifications. Is there something wrong?<!--content-->
I solved my posted question:<br /><br /><?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']) ?><br /><br />However, I failed to do similar things in .htaccess. Textbook examples have<br /><br />RewriteCond %{REMOTE_HOST} ...<br /><br />but does not work (because it is always null). Why?<!--content-->
My knowledge of playing with .htaccess is limited. Maybe you should send a support ticket.<!--content-->
 
Back
Top