Anyone know why $REMOTE_HOST may not return any data?
Php running on Linux with Apache. Do I have to do something more?
$REMOTE_HOST doesnt work...
Whether such a predefined variable is available or not depends on the server.
It could also be that you need to use $_SERVER['REMOTE_HOST']
conversely, it could be that you should be using some other variable for what you want.
I want to return the clients IP and HOST information. Supposedtly $REMOTE_ADDR; and $REMOTE_HOST; are the ones. any other recommendations?
Maybe you don't have register_globals on. Try laserlight's suggestion of using the $SERVER array, i.e. $SERVER['REMOTE_HOST'] and $_SERVER['REMOTE_ADDR'].
Diego
try this print_r ($GLOBALS);
this will give you all the variables in the array
reg
kevin
I may not be able to answer your question but I did try what you suggested.
I can access the client's IP address using REMOTE_ADDR but REMOTE_HOST is not printed in the list of globals when i use the
print_r($GLOBALS);
It does however give us the IP address as well as user agent.
i think it has something to do with the DNS settings.
Chances are if you have a dynamic IP address, your system might not have a hostname to show, therefore your REMOTE_HOST would not be set.
Chris
Remote_host is available for my ip because Ive tested it with the php machine running on a diffrent server.
When doing print_r($GLOBALS); its also not part of the list.
$_SERVER('REMOTE_HOST')...etc doesnt work either.
Whats causing this variable to not return data? is it server settings.? or what?
$_SERVER('REMOTE_HOST')...etc doesnt work either.
It's $SERVER['REMOTE_HOST'], not $SERVER('REMOTE_HOST')
Whats causing this variable to not return data? is it server settings.? or what?
Check your register_globals setting in php.ini.
Diego
$_SERVER('REMOTE_HOST') this was a typo in my post
I tried this and it didnt work.
$_SERVER['REMOTE_HOST']
None of these work:
$whatever = getenv("REMOTE_HOST");
$whatever = $_SERVER['REMOTE_HOST']
$whatever = $REMOTE_HOST;
and when I do
$_ENV['REMOTE_HOST'];
it returns
" localhost "
?????/
What is the specific setting in php.ini to enable REMOTE_HOST to "register"?
I noticed that its returning it under "Apache Environment" in phpinfo.php .
here it is.
http://www.coldtrax.com/phpinfo.php
for some reason REMOTE_HOST just isnt showing up...
anyone?
I GOT IT. yessssssssssssssss.
$wooz = gethostbyaddr($_SERVER['REMOTE_ADDR']);