title: hostname -I in python/php
body: <p>I'm having PHP and Python scripts running on different machines, and I want to get the IP of the machine from these scripts.</p>
  <p>It seems like it's directing me to the loopback device and not to the network card whenever I try this from within the machine (which is where these scripts are located).
  When I called PHP script that only runs <code>phpinfo();</code> from the browser I had the wanted result but when I used curl it gave me the loopback address.</p>
  <p>I tried multiple ways that should work</p>
  <p>in Python:
  <code>socket.gethostbyname(socket.gethostname())</code></p>
  <p>in PHP:
  <code>$_SERVER['HTTP_HOST']</code> or <code>getHostByName(php_uname('n'));</code></p>
  <p>The bash command <code>hostname -I</code>, is working for me since it's ignoring the loopback address. I wanted to know if there's something like this built-in PHP/Python.
  Otherwise, I think my solution would be to just call this bash command from these scripts.</p>