How to know which page is the URL redirecting to in PHP?
<p>If I have a URL (eg. <a href="http://www.foo.com/alink.pl?page=2" rel="nofollow">http://www.foo.com/alink.pl?page=2</a>), I want to determine if I am being redirected to another link. I'd also like to know the final URL (eg. <a href="http://www.foo.com/other_link.pl" rel="nofollow">http://www.foo.com/other_link.pl</a>). </p>

<p>I want to know how to do that in PHP</p>

<p>Thank you all for your help :)</p>

<p>(more information:</p>

<p>I want to have a function that is called doesItDirect($url) which returns the url which it redirects to if true, and it returns the same url passed if false</p>

<p>)</p>
