If I have :
domainA.com/out.php :
<?php
header('location: http://domainB.com/');
?>
Is it possible to get url : domainB.com and it’s IP Address, with domanA.com/out.php from domainC.com?
What I want :
domainA.com/index.php
<?php
$data = getUrlandIp("domainA.com/out.php");
echo $data[0]; # wanted output (URL) : domainB.com
echo $data[1]; # wanted output (IP) : 133.133.133.133
?>
If you need to get all the redirects, you can do
This will return an array holding all the redirects with the last entry being the final destination.
Example (demo)
Output
You’d have to lookup the IP’s manually though (see other answers here) but note that a redirect target doesnt have to be a hostname. It can very well be an IP as well.