Pythorian

3 Ways to get local IP information in [PHP]

Oct 5th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.18 KB | None | 0 0
  1. <?php
  2.  
  3. echo gethostbyname(trim(gethostname())) . "\n";
  4. echo $_SERVER['SERVER_ADDR'] . "\n";
  5. echo exec("/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'");
  6.  
  7. ?>
Advertisement
Add Comment
Please, Sign In to add comment