Re: [PHP] Get Local IP Address
Try this: ?php exec('ipconfig',$catch); foreach($catch as $line){ if(eregi('IP Address',$line)){ list($t,$ip) = split(':',$line); echo 'IP is '.$ip.\n; } } ? Thanks Tom, but I think it only work for Win NT, how about Win 9x? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Local IP Address
For Win9x, use winipcfg instead of ipconfig. --- Chris Lee [EMAIL PROTECTED] wrote: Try this: ?php exec('ipconfig',$catch); foreach($catch as $line){ if(eregi('IP Address',$line)){ list($t,$ip) = split(':',$line); echo 'IP is '.$ip.\n; } } ? Thanks Tom, but I think it only work for Win NT, how about Win 9x? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Local IP Address
[EMAIL PROTECTED] Mark: For Win9x, use winipcfg instead of ipconfig. winipcfg is a windows-based utility, which can't work with PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Local IP Address
* Thus wrote Tom Rogers ([EMAIL PROTECTED]): Hi, Monday, July 28, 2003, 4:29:46 PM, you wrote: Try this: ?php exec('ipconfig',$catch); foreach($catch as $line){ if(eregi('IP Address',$line)){ list($t,$ip) = split(':',$line); echo 'IP is '.$ip.\n; btw, the $ip needs to be trimmed it actually contains a space at this point ' XXX.XXX.XXX.XXX' } } ? CL Thanks Tom, but I think it only work for Win NT, how about Win 9x? There is ipconfig.exe in win98 SE thats about all I know. win98 has that command. when I issue that on my computer I get multiple interfaces back something like: interface 0: [interface data] interface 1: [interface data] So the above code wont guarantee the correct IP address. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Local IP Address
Hi, Monday, July 28, 2003, 12:21:06 PM, you wrote: CL How can I get the local Computer IP Address when running PHP program in CL Windows command line (i.e. php getmyip.php) CL ** Since the PHP did not are run on Webserver, so _SERVER[SERVER_ADDR] CL won't work. CL Many thanks in advance. CL Regards, CL Chris Try this: ?php exec('ipconfig',$catch); foreach($catch as $line){ if(eregi('IP Address',$line)){ list($t,$ip) = split(':',$line); echo 'IP is '.$ip.\n; } } ? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php