I once wrote a script to do just that: // get W2K ipconfig info: $text = `ipconfig` ; // back ticks, not single quotes
// first extract text block after "PPP" $needle = "PPP" ; $a = strstr( $text, $needle ) ; $a = substr( $a , 0, 180 ) ; // then extract IP address $needle = "IP Address. . . . . . . . . . . . : " ; $a = strrchr( $text, $needle ) ; $a = substr( $a , 35, 16 ) ; $new_ip = trim( $a ) ; Not quite elegant, but efficient (W2K format for ipconfig - I don't know if it also applies to Windows 98) (Le bazar me servait à rediriger vers une adresse IP dynamique...) En espérant avoir été utile... Ignatius ____________________________________________ ----- Original Message ----- From: "Michael Delorme" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 25, 2002 6:52 PM Subject: [PHP-WIN] Getting my IP adress (not 127.0.0.1) > Hi > > I try to get my local IP adress : > > <?php > $arrIp = gethostbynamel("localhost"); > foreach ($arrIp as $ip) { > echo $ip."<br />"; > } > ?> > > However I only get 127.0.0.1 > But I want the "public" dynamic adress my ISP gave me, as shown by the > ipconfig windows command. > > Thanks in advance > M > _________________________________________ > Michael Delorme > 41 bd de Brou > 01000 Bourg-en-Bresse > > tel/fax 04 74 23 26 10 > mailto:[EMAIL PROTECTED] > _________________________________________ > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php