Charles likes PHP wrote:
Maybe I'm not understanding your situation properly so please correct me if I'm wrong. URLs should have the FQDN not IP address. DNS was created so that fixed, easy to remember, names could be given to computers not numbers. The numbers (IP address) may change.Does anyone know a way to fetch your own IP-adress? I need it because I run a web server on my computer with a dynamic-IP so I need it to change all the URLs it creates dynamically...
If you are running a server, its hostname should be fixed, e.g. mybox.myisp.com whilst its ip address may change.
I suggest that you use $_SERVER['SERVER_NAME'] in the URL. Its populated with Apache under linux, but whatever you are using you should have a way to get the hostname. Best if you are running a server is to get a static ip address from your isp but few will have them these days (I'm on a static IP address from Demon Internet). As long as your hostname remains the same you will have little problem. Your isp should provide forward DNS for your hostname (they should provide reverse too). Maybe for dns you may need something like dyndns.org.
Some broadband ISPs use hostnames based upon the IP address e.g. dsl-111.222.333.444.myisp.com. It saves them playing with DNS and are intended for end users (who would usually have no problem with it as they would not be trying to run a server).
Hope this helps.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php