PDA

View Full Version : remote_address



tio
07-13-2009, 09:19 AM
hello -

i've been working with php for a while now and have honestly no clue what is going on on the hm server.

i'm still developing my app. and wanted to test a function which is dervied from the app it self. and it doesn't work on there server currently.

i have used and echod my ip from php and have checked every thing to ensure i didn't flag it or something.

but here is the link www.only1wizard.com/test.php

this is just a demo to ensure that it is capturing the ip address etc...

here is the code:
[code]
<?$
2 $visitor_ip = GetHostByName($REMOTE_ADDR) ;$
3 $ip = $visitor_ip ;$
4 echo "<br> Your IP address : " . $ip;$
5 echo "<br> Your hostname : " . GetHostByName($ip);$
6 ?>$
[code]
thanks in advance for your help!

tio

shadmego
07-13-2009, 10:51 AM
I believe I would need to see the function GetHostByName before I can help with this. I clicked the link and got blanks where I should have gotten my IP address ...

~regards

P.S. I am also unsure as to why there are dollar signs at the end of each line? Is that actually in your code? Is there a reason for those characters?

tio
07-13-2009, 12:50 PM
thanks -

yes that $ signs and numbers were a direct copy from vi shell.

rleeden
07-13-2009, 01:35 PM
Not entirely sure what you are trying to do here, but if you just want to display a visitor's IP address and Hostname try:



<?php
$ip = $_SERVER["REMOTE_ADDR"];
$hostname = gethostbyaddr($ip);

echo "Your IP address : " . $ip . "<br>";
echo "Your Hostname : " . $hostname . "<br>";
?>

tio
07-13-2009, 04:39 PM
sorry but it was resolved earlier. i thought i added that.