473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Get the server's ip address

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
Oct 15 '06 #1
1 1952
$_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
Oct 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: tshad | last post by:
I am trying to run a test sending mail using CDONTS on my W2K3 machine. It works fine running from my WXP Pro, but I don't recieve the mail if run the W2K3 machine. Both machines have IIS...
3
by: Ellen K | last post by:
Hi all, We have standardized on Hyperion as our reporting tool. So far I have only set up a couple of Access databases as data sources for it. Now there is a request to report off our eOn...
10
by: Jim H | last post by:
I have a UDP socket that sends out a request on a multicast socket and waits for a response. This client is not listening on a multicast IP but the local IP. The server (UNIX) responds to the...
4
by: Bob H | last post by:
Hi, I'm aware of the different ways to pass variables between ASP.Net pages. For pages that need to pass a variable, we're using the server.transfer method. For others, we're using...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
3
by: RFD | last post by:
I've been slaving at this problem for over a week, and would appreciate some help from you kind folks. Basic Problem: I have made a server program and a client program. When I try to use the...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
0
by: sarahnetworking | last post by:
Hello, I have developed a client server application using C. i have a list of usernames and a list of passwords in a text file. i need to be able to do 2 loops so i can send the usernames and...
1
by: andrew.smith.cpp | last post by:
Hello All :-), i last Posted a request about the spam at google and someone told me about PAN i install it on my PC but when i start it and the msg shows there is no server selected .and then i...
7
by: RN1 | last post by:
Is it possible to connect to my local SQL Server 2005 database from a remote web server? If yes, what ConnectionString do I use? Thanks, Ron
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.