cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: FOLLOWLOCATION kills Apache?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 25 Dec 2004 08:52:30 +0100 (CET)

On Fri, 24 Dec 2004, Josh Santangelo wrote:

> If I set CURLOPT_FOLLOWLOCATION to 1, my script runs forever and the Apache
> process dies.

You mean the Apache process which runs your PHP program? How can libcurl make
it die?

followlocation has a default max number of redirects it follows, just to
prevent it from doing it "forever".

You need to provide us with more details on what curl sends and receives,
header-wise. Use CURLOPT_VERBOSE and CURLOPT_DEBUGFUNCTION to get all details.

> curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/curlcookie_' . time());

This option writes the received cookies to a file, it doesn't read them before
sending off your (first) request.

> 'Content-Type: application/x-www-form-urlencoded',
> 'Content-Length: ' . strlen($postfields)

Both these headers are set by libcurl itself when you POST, so your setting of
them is not necessary.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-25