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