cURL / Mailing Lists / curl-users / Single Mail

curl-users

FOLLOWLOCATION now working?

From: Erick Papadakis <erick.papa_at_gmail.com>
Date: Mon, 18 Jun 2007 05:33:11 +0800

Hi,

I am using the CURLSETOPT_FOLLOWLOCATION variable in PHP.

When I try the code on my localhost (Windows apache) it works. The url
mentioned in the 302 header gets called automatically.

But when I try the exact same code on my hosting Linux CentOS server,
it doesn't work. Curl in general is working on both platforms, only
this auto-redirection bit is not working on Linux.

Googling for this issue suggested some old problems with OPENBASEDIR.
But I have confirmed that my server does not have OPENBASEDIR enabled
or even installed. I am on the typical Cpanel/WHM dedicated hosting
stuff.

Any other things I could take a look at? This is my fairly
straightforward code:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
    curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
    curl_setopt($ch, CURLOPT_MAXREDIRS, 5);

Thanks
EP
Received on 2007-06-17