|
Posted by Manuel Lemos on 11/18/41 11:44
Hello,
on 04/07/2006 07:14 AM Leo said the following:
> Can anyone help or offer some explanation with this problem:
>
> I'm trying to do a POST from one of my PHP pages, to another page on my
> site using curl.
> To maintain the session I'm sending the current session cookie in the
> headers using
>
> $headerArray = array("Cookie: " . session_name() . "=" .
> session_id());
>
> then
>
> curl_setopt( $ch, CURLOPT_HEADER, 1 );
> curl_setopt( $ch, CURLOPT_POST, 1 );
> curl_setopt( $ch, CURLOPT_POSTFIELDS, $postArray );
> curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 );
> curl_setopt( $ch, CURLOPT_HTTPHEADER, $headerArray);
> curl_exec( $ch );
>
> The problem is, once this is submitted, Apache goes into an infinite
> loop and has to be restarted. This only happens when I send the
> current session cookie, if I change it slightly there's no problem
> (although obviously the session is lost).
>
> There seems to be mention of a similar problem on the post called 'CURL
> and $_SESSION problem' but the guy is trying to achieve something
> different so it doesn't get addressed.
It seems like a bug in the Curl library.
You may want to try this HTTP client class. You can enable debug output
and see the HTTP dialog to figure exactly what is going on. It supports
cookie handling, so it should work for your purposes:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
[Back to original message]
|