Page 1 of 1

PHP cURL redirect

Posted: Wed Sep 23, 2009 4:14 pm
by tangoking
I'm trying to use cURL to redirect the user from my page to another site, but the new URL does not display in the address bar.

For example, http://www.foo.com/transfer.php should redirect the user to http://www.bar.com/index.php. The following code fetches bar.com/index.php, but still displays foo.com/transfer.php in the address bar.

I want to completely transfer control to the new site. Any suggestions? Here's the code that I'm using.

Code: Select all

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.google.com");
curl_exec ($ch);
curl_close ($ch); 
 

Re: PHP cURL redirect

Posted: Wed Sep 23, 2009 4:35 pm
by jackpf
Just send a location header with header().

Re: PHP cURL redirect

Posted: Wed Sep 23, 2009 8:02 pm
by tangoking
tyvm!

Re: PHP cURL redirect

Posted: Thu Sep 24, 2009 5:38 am
by jackpf
:)