Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718641
Share on other sites

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;

?>

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718657
Share on other sites

<?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.

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718879
Share on other sites

<?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.

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-718903
Share on other sites

<?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

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-719277
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/137519-solved-showing-ip/#findComment-719476
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.