You are here: Re: get IP address « PHP Language « IT news, forums, messages
Re: get IP address

Posted by Z.K. on 09/10/07 01:25

macca wrote:
> Try something like:
>
> echo $_SERVER['SERVER_ADDR'];
>
>
>
>
> Tip: type this and save it as phpinfo.php
>
>
> <?php
>
> phpinfo();
>
> ?>
>
> Run the file and you will get loads of useful info about your PHP
> installation including many of the PREDIFINED VARIABLES that you can
> access from in your scripts. SERVER_ADDR is one of them.
>
>
> As for a reference book, you can't do any better than the php manual
> at
>
> http://www.php.net/manual/en/index.php
>
> Which you can also download to your computer free from php.net
>
>
>
> Regards,
>
> Paul.
>

The command: echo $_SERVER['SERVER_ADDR'];
helped me do exactly what I wanted. Thanks a lot.

I just stuffed into a variable and now when I access my server from my
other machines, it gets the correct IP address. I still need to know
what my server address is to access it, but at least I don't have to
keep changing the php files with the hard coded IP address.

Thanks,

Z.K.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация