Re: Get Local IP Address
| From: | Curt Zirzow | Date: | Mon, 28 Jul 2003 17:11:43 +0000 |
| Subject: | Re: Get Local IP Address | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157207@lists.php.net to get a copy of this message | ||
* Thus wrote Tom Rogers (trogers@kwikin.com):
> 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."