I need to fetch the given website ip address using php, that is ip address of server in which website is hosted.
For that i've used gethostbyname('**example.com*')
. It works fine when the site is not redirected. for example if i used this function to get google.com, it gives "74.125.235.20".
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.
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.
How should i get this? any help greatly appreciated, Thanks!.