title: get website ip using php
body: <p>I need to fetch the given website ip address using php, that is ip address of server in which website is hosted.  </p>
  
  <p>For that i've used <code>gethostbyname('**example.com*')</code>. It works fine when the site is not redirected. for example if i used this function to get <strong>google.com</strong>, it gives "74.125.235.20".  </p>
  
  <p>When i tried it for "lappusa.com" it gives "lappusa.com". Then i tried this in browser it is redirecting to "http://lappusa.lappgroup.com/" . I checked the http status code it shows 200.</p>
  
  <p>But i need to get ip address even if site was redirected, like if lappusa.com is redirected to lappusa.lappgroup.com then i need to get ip for redirected url.  </p>
  
  <p>How should i get this? any help greatly appreciated, Thanks!.</p>