Birdmansplace Posted December 18, 2008 Share Posted December 18, 2008 I am been spending hours trying to figure this out. I want to so my ip addy on my web site. Meaning when "user" goes to my site i want to show them my ip not theres. Like nslookup. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/ Share on other sites More sharing options...
ILMV Posted December 18, 2008 Share Posted December 18, 2008 This may or may not work, worth a shot... $_server['server_ADDR']; Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718635 Share on other sites More sharing options...
Birdmansplace Posted December 18, 2008 Author Share Posted December 18, 2008 been there done that. being that the webserver is localhost an another computer on my net i have only been able to get the ip of the computer viewing it or computer host name. I am after the host ip. My isp is dhcp so my ip changes some times daily and i would like to have something that checks and echos my ip or something like that. I want users to see my ip from any where in the world. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718641 Share on other sites More sharing options...
ILMV Posted December 18, 2008 Share Posted December 18, 2008 I did a bit of a Google search and it seems that what you are trying to achieve is very difficult. Unless you could run a script (VB, C++) on the server itself every hour for example, store the value in a database? Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718642 Share on other sites More sharing options...
Birdmansplace Posted December 18, 2008 Author Share Posted December 18, 2008 maybe i will just have to figure out how to do script a nslookup and just have my site preloaded and all they have to do it submit and presto Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718645 Share on other sites More sharing options...
beansandsausages Posted December 18, 2008 Share Posted December 18, 2008 Just curious, Why would you want to do that? Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718652 Share on other sites More sharing options...
Birdmansplace Posted December 18, 2008 Author Share Posted December 18, 2008 well its for my game server and entering a http://whereever.whatever wount connect you to it. so the only way is by ip so to make it easyer for them to just give them the ip address. And i figured out the php script to do so <?php $ip = gethostbyname ('yourwebsitehere'); echo $ip; ?> Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718657 Share on other sites More sharing options...
premiso Posted December 18, 2008 Share Posted December 18, 2008 <?php $serverIP = $_SERVER['SERVER_ADDR']; echo $serverIP; ?> That is probably more efficient and less resource intense. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718703 Share on other sites More sharing options...
ILMV Posted December 18, 2008 Share Posted December 18, 2008 <?php $serverIP = $_SERVER['SERVER_ADDR']; echo $serverIP; ?> That is probably more efficient and less resource intense. He has already said that this didn't work... Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718764 Share on other sites More sharing options...
premiso Posted December 18, 2008 Share Posted December 18, 2008 <?php $serverIP = $_SERVER['SERVER_ADDR']; echo $serverIP; ?> That is probably more efficient and less resource intense. He has already said that this didn't work... He probably literally tried it like $_server['server_ADDR']; Of course that WILL NOT work due to the fact that php is CasE SeNsItIve....Next time post the exact way he should access it. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718879 Share on other sites More sharing options...
premiso Posted December 18, 2008 Share Posted December 18, 2008 <?php $serverIP = $_SERVER['SERVER_ADDR']; echo $serverIP; ?> That is probably more efficient and less resource intense. He has already said that this didn't work... He probably literally tried it like $_server['server_ADDR']; Of course that WILL NOT work due to the fact that php is CasE SeNsItIve....Next time post the exact way he should access it. Edit, my bad, just noticed the 3rd post. But the same goes for the above, if he was trying that it probably would fail due to the case sEnSitIvE issue. Sorry for the rude remark I made. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718903 Share on other sites More sharing options...
PFMaBiSmAd Posted December 18, 2008 Share Posted December 18, 2008 $_SERVER['SERVER_ADDR'] would give the local network address of the server and not the public IP address. being that the webserver is localhost an another computer on my net ... Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-719121 Share on other sites More sharing options...
ILMV Posted December 18, 2008 Share Posted December 18, 2008 <?php $serverIP = $_SERVER['SERVER_ADDR']; echo $serverIP; ?> That is probably more efficient and less resource intense. He has already said that this didn't work... He probably literally tried it like $_server['server_ADDR']; Of course that WILL NOT work due to the fact that php is CasE SeNsItIve....Next time post the exact way he should access it. Edit, my bad, just noticed the 3rd post. But the same goes for the above, if he was trying that it probably would fail due to the case sEnSitIvE issue. Sorry for the rude remark I made. No problem ILMV Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-719277 Share on other sites More sharing options...
Birdmansplace Posted December 19, 2008 Author Share Posted December 19, 2008 I am not to bothered by what uses what as long as the computer can handle it. I am still in the "start up" of my site anyways. I only have 3 members including me and they haven't been back in a few months. But for those who want to at least check out go to http://birdmansplace.myftp.org On a side note i could use some smart phper's with my site. I am on the look for members to add to my staff. Quote Link to comment https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-719476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.