how do i get the ip of my own system?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

how do i get the ip of my own system?

Post by susrisha »

i am running a socket program for which i need the ip of the system where the server is located(my own system).

The problem is how do i get the ip of my system using php?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: how do i get the ip of my own system?

Post by aceconcepts »

Code: Select all

$_SERVER['REMOTE_ADDR']
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: how do i get the ip of my own system?

Post by Syntac »

If I'm not mistaken, that gets the IP of the client.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: how do i get the ip of my own system?

Post by Eran »

You are not mistaken.

Code: Select all

 
$_SERVER['SERVER_ADDR'];
 
oddsmojo
Forum Newbie
Posts: 6
Joined: Thu Nov 06, 2008 9:23 am

Re: how do i get the ip of my own system?

Post by oddsmojo »

your server IP is 127.0.0.1
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: how do i get the ip of my own system?

Post by aceconcepts »

oops misread your post :lol:
Post Reply