neugi Posted May 20, 2007 Share Posted May 20, 2007 hi, is there a way go get the new url of a redirection from an external server? for eg.: http://www.test.com/red=addItem will be redirected to this url: http://www.test.com/additem.php is there a way go get this url with php? thx Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/ Share on other sites More sharing options...
radar Posted May 20, 2007 Share Posted May 20, 2007 header("LOCATION: http://www.test.com/additem.php"); when you have your thing like... switch ($red) { case additem: header("LOCATION:http://www.test.com/additem.php"); break; } note that the header command will not work if any html has been passed before you call it. Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257643 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 <?php $pagename = $_GET['red']; header("Location: $pagename.php"); ?> Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257644 Share on other sites More sharing options...
neugi Posted May 20, 2007 Author Share Posted May 20, 2007 my problem is, i got an url with an id, an this url will be redirected to some new url with some unkonwn id. is there a way to get the new url with the new id? i need a script where i can enter a url and the script returns me the new url where this page will be redirected best Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257649 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 I'm lost. Can you explain in more detail please? Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257661 Share on other sites More sharing options...
radar Posted May 20, 2007 Share Posted May 20, 2007 yeah i'm lost too... and that never happens... Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257662 Share on other sites More sharing options...
neugi Posted May 20, 2007 Author Share Posted May 20, 2007 okay here is an eg from a nother page that explains such problem: http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/constructing_youtube_1.php on this page they are entering a url from youtube to get the real url of the flv file. they create the new url with the action script an i would need something like this in php. i hope this will help best Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257670 Share on other sites More sharing options...
neugi Posted May 20, 2007 Author Share Posted May 20, 2007 hi, got the the problem solved. i'll use the get_headers() function so the the redirect link best Link to comment https://forums.phpfreaks.com/topic/52229-solved-get-redirected-url/#findComment-257768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.