For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > Re: Find localhost?s IP number









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Find localhost?s IP number
Chung Leong

2004-07-20, 8:55 pm


"steve" <UseLinkToEmail@dbForumz.com> wrote in message
news:TvgLc.55193$5Y.34823@cyclops.nntpserver.com...
> Hi, I am running apache on local pc/ under Windows.
>
> I need to figure out the ip number of the pc inside PHP. This is the
> number available when you do ipconfig, and not the 127.0.0.1!
>
> So the slow way I have figured out is to do a system call to doc,
> using `ipconfig`, and then regex the result and figure out the ip.
> Is there a fater/more efficient way to do this?
>
> --
> http://www.dbForumz.com/ This article was posted by author's request
> Articles individually checked for conformance to usenet standards
> Topic URL:

http://www.dbForumz.com/PHP-Find-lo...pict131475.html
> Visit Topic URL to contact author (reg. req'd). Report abuse:

http://www.dbForumz.com/eform.php?p=438714

gethostbynamel($dns_name_of_computer).


steve

2004-07-20, 8:55 pm

"Chung Leong" wrote:
> "steve" <UseLinkToEmail@dbForumz.com> wrote in message
> news:TvgLc.55193Y.34823@cyclops.nntpserver.com...
> the
> ip.
> author’s request
> http://www.dbForumz.com/PHP-Find-lo...pict131475.html
> abuse:
> http://www.dbForumz.com/eform.php?p=438714
>
> gethostbynamel($dns_name_of_computer).


I don’t have DNS on my pc, so I tried
gethostbynamel(’localhost’)
but it returns 127.0.0.1

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Find-lo...pict131475.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=438855
jrblast

2004-07-23, 3:53 pm

u can try www.whatistmyip.com but you cant be using a proxy thats what i did and it works also if you dont have a static ip you can use something like www.no-ip.com and ur url will be like this.no-ip.com hope i helped :D
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com