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

curl-and-php

Re: CURL, POST an Cookies???- AGAIN!!!

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 25 Nov 2003 08:17:28 +0100 (CET)

On Mon, 24 Nov 2003, Alexei Zoubov wrote:

> $url_l = 'http://www.superpayline.com/SAFELIST/members/login.php';
> $post_arr_l = array (username => 'alexei', password => 'govno', action=
> => 'click here to login');
>
> if (!$c2 = curl_init()) return "Bad connection!";
> curl_setopt($c2, CURLOPT_POST, true);
> curl_setopt ($c2, CURLOPT_HEADER,1);
> curl_setopt($c2, CURLOPT_POSTFIELDS,$post_arr_l);

Is that page really using multipart formpost for a simple login page? It is
not something your ordinary webmaster would do. He would use a plain POST.

> curl_setopt($c3,CURLOPT_COOKIE,'splistmem=alexz; expires=Mon,
> 24-Nov-03 17:20:37 GMT');
> curl_setopt($c3,CURLOPT_COOKIE,'splistpass=govno; expires=Mon,
> 24-Nov-03 17:20:37 GMT');

 1 - You can only set CURLOPT_COOKIE once, thus you override the first string
     with the second one you set.

 2 - You seem to lack understanding on what cookies are and how they work.
     Those strings you tell curl to send are clones of what you received from
     the server, which is not what the server will expect you to send. I
     would recommend you read up on this before you continue.

 3 - This might work better:
     curl_setopt($c3,CURLOPT_COOKIE, "splistmem=alexz; splistpass=govno;");

> I also tried to write received cookies to "cookies.txt" file by using:
>
> curl_setopt($c2, CURLOPT_COOKIEJAR, "cookies.txt");
>
> and then sending them in the next request with
>
> curl_setopt($c3, CURLOPT_COOKIEFILE, "cookies.txt");
>
> Well, cookies get written to the file, but after that - nothing!

I don't believe you. Show me what headers curl received and what headers curl
sent.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
Received on 2003-11-25