Determine Final Destination of a Shortened URL in PHP?
问题 How can I do this in PHP? e.g. bit.ly/f00b4r ==> http://www.google.com/search?q=cute+kittens In Java, the solution is this: You should issue a HEAD request to the url using a HttpWebRequest instance. In the returned HttpWebResponse, check the ResponseUri. Just make sure the AllowAutoRedirect is set to true on the HttpWebRequest instance (it is true by default). (Thx, casperOne) And the code is private static string GetRealUrl(string url) { WebRequest request = WebRequest.Create(url); request