Reply to Re: Get the server's ip address

Your name:

Reply:


Posted by ruibalp on 10/15/06 06:44

$_SERVER['SERVER_ADDR'] // should work for php/apache

you could try seeing if there's anything specific to your webserver by
print_r($globals)

Are you running a CLI script?

There might be something in pear, I'd check the Net or Socket related
packages
you could also see if there's something in pear...

If the socket_* methods aren't blocked, you could attempt to make an
outgoing socket connection to an HTTP port or something you _know_ you
can connect to (i.e. 'http://google.com:80'), and then read the local
IP address of outgoing socket. for example:

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($sock, '66.102.7.147', 80);
socket_getsockname($sock,$hn);
print($hn);
socket_close($sock);

hope it helps

tg

On Oct 14, 1:20 pm, at(nospam) <"lasse(at(nospam))the87boy.dk"> wrote:
> Hey
>
> I'm looking for a script, which finds the ip address of the server, it's
> running on
> It should be compatible with both Linux and Windows

[Back to original 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

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