scripting - PHP script redirection -


I need help with a redirect on php scripts. The problem is: I have a page, for example www.domain.com/redirect.php?id=34 which redirects to any other page, domain2.com/product.php?id=2 I need to create a script Which allows me to know the URL of redirection (domain2.com/product.php?id=2) until the redirector (www.domain.com/redirect.php?id=34). Anyone have an idea? Tanks! ;)

A solution is opening the socket at www.domain.com, sending a request, waiting and Read / Parsing HTTP "Location: ...." Title.

Or if you are using PHP 5.0 or above, you can take advantage of it.

  $ url = 'http: //www.google.com/'; $ Headers = get_headers ($ url, 1); $ Redirect = isset ($ header ['location'])? $ Header ['location']: '';  

Comments