How to get final URL after following HTTP redirections in pure PHP?
问题 What I'd like to do is find out what is the last/final URL after following the redirections . I would prefer not to use cURL. I would like to stick with pure PHP (stream wrappers). Right now I have a URL (let's say http://domain.test), and I use get_headers() to get specific headers from that page. get_headers will also return multiple Location: headers (see Edit below). Is there a way to use those headers to build the final URL? or is there a PHP function that would automatically do this?