Page 1 of 1

How to Redirect a URL in PHP

Posted: Tue Nov 23, 2004 6:37 am
by DudeBori82
I am trying to execute code in php, then when it is finished, redirect the user to a new page. Is this possible? If so, what is the code?

Posted: Tue Nov 23, 2004 6:39 am
by John Cartwright
Once the code is parsed then it is parsed. Why not just put it at the bottom of the page?

Code: Select all

<?php
header("Location: http://www.newsite.com");

?>

Posted: Tue Nov 23, 2004 6:51 am
by DudeBori82
OK, here's a tricky question, how do you send data back with that redirect using POST or GET and how do you control what frame it enters into? (if you are using a frame set)

Posted: Tue Nov 23, 2004 7:08 am
by peni
1. get - just add it like "?a=b" to the url
2. post - you can use curl in order to do it
3. what is a frame? i thought php was server-side...

Posted: Tue Nov 23, 2004 7:31 am
by DudeBori82
What is curl?
An HTML Frameset on the target URL

Posted: Tue Nov 23, 2004 7:42 am
by peni
php.net/curl

a frameset exists only client-side
server-side, where php works, there are only single php pages.