Categories
Archives
Recent Comments
- Ralph on Merge CSS files into one file with PHP
- top website design on Base64 Encoding Class in ActionScript 3
- jqueryexample.com » Best jQuery Charts Library » jqueryexample.com on 7 best jQuery charts engines
- Brian on Merge CSS files into one file with PHP
- Brian on Merge CSS files into one file with PHP
ETC
RSS Links
Tag Cloud
5.3 abstract actionscript actionscript3 Adapter adobe Advance apache Array article as as3 as3corelib Auth Base64 basics bind bitmap bytearray callback chart charts class cleanup CodeIgniter commerce compiler controller crypto css custom event Decryption design patterns dialog dispatch div download Dwoo ecommerce editor Encode Encryption engine ereg ereg_replace error event example experiment facebook Factory Factory Method file Flash Flash Media Server FMS Framework free function garry GNU GPL grchart hash link html ide ifconfig image insert ip javascript jpeg jQuery jquery plugin js json lachman layer Layout Solution lib libary linux load local localhost login manager MD5 MDB media Migrating Mime Type module modules mod_rewrite mvc mysql News Object Oriented old one time link one time url OOP Open Power Template open source oscommerce package pattern PEAR PEAR::Auth php php4 php5 php 5.3 phpclasses.org PHP Framework phpwebcommerce plugin PNG popup posfix POST preg_match preg_replace Presentation problem rect regex regexp Requirements screen screen manager script select server session shopping Shopping Cart singleton smarty Solution source code Specification sql ssh static STP table templates this tooltip trigger Tutorial UI update url User Interface users utf-8 util utils validate variables vi view vim virus warning widget window wordpress XTemplate yourinspirationweb
PHP: Get local ip adresses using ifconfig (linux only)
Hi,
I wrote little code to get local machine ip address:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ips = array();
exec("/sbin/ifconfig", $catch);
foreach($catch as $line){
if (eregi('inet addr:', $line)) {
$line = str_replace(" ", ":", $line);
$line = explode(":", $line);
$line = array_filter($line);
foreach ($line as $v) {
if (ip2long($v)) {
$ips[] = $v;
}
}
}
}
return $ips;
}
have fun
Garry