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

curl-and-php

Re: Problem with cookie handling (CURLOPT_COOKIEJAR)

From: Steve Smith <steve_at_bakeacake.com>
Date: Tue, 03 Dec 2002 11:57:27 -0500

You need to create the 'cookie.txt' file yourself. I don't think cURL will
create a file for you. (I could be wrong, its been a while)

The cookie.txt file is located in the same folder as the script is running
in, unless you tell it to go somewhere else.

It works man.

Steve

> From: Beerman <beerman_at_divx.com.pl>
> Organization: DivX.com.pl
> Reply-To: curl-and-php_at_lists.sourceforge.net
> Date: Tue, 3 Dec 2002 14:22:07 +0100
> To: curl-and-php_at_lists.sourceforge.net
> Subject: Problem with cookie handling (CURLOPT_COOKIEJAR)
>
> Hi there :)
>
> I try to get cookies from first page and keep them in a file for next
> pages.
>
> $ch = curl_init();
> curl_setopt($ch,
> CURLOPT_URL,"https://www.a1.net/CDA/login/login_user_tr/1,2767,786-789-html-de
> ,00.html");
> curl_setopt($ch, CURLOPT_VERBOSE, 1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, "Here's my login and passwd data");
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
> $page = curl_exec ($ch);
> curl_close ($ch);
> echo nl2br($page);
>
>
> Everything is OK, i can see header with cookie data :
>
> HTTP/1.1 302 Moved Temporarily
> Server: Netscape-Enterprise/4.1
> Date: Tue, 03 Dec 2002 13:10:48 GMT
> Set-Cookie: mkUpdateId=CTR(64-1):ieemvJlypd6ytYR9t6qor5/QoYWqqa5ghXyv; path=/
> Set-Cookie: mkssuid2=beerman2; path=/; expires=Saturday, 06-Sep-2014 23:50:08
> GMT; domain=.a1.net
> Location:
> http://www.a1.net/sms/sms_weltweit_frame/0,3024,14-813-html-de,00.html
> Content-length: 0
>
>
> Than cURL follows by "Location:" header
>
> HTTP/1.1 200 OK
> Server: Netscape-Enterprise/4.1
> Date: Tue, 03 Dec 2002 13:10:48 GMT
> Content-type: text/html
> Transfer-Encoding: chunked
>
> But there is no cookie.txt file created in my home directory :(
>
> What do i wrong ?
>
> Thnx for help in advance.
>
> Best regards
>
> --
> _______ beerman_at_divx.com.pl ______ ___ _GG:235429___ICQ:37186302_
> \____ PGP Key ID : 0x7E9C34CA ___/ / _ )___ ___ ___,__ _ ___ ___\
> \_____ WIRELESS SOLUTIONS _____/ / _ / -_) -_) __/ ' \/ _ `/ _ \\
> \__ http://wap.divx.com.pl __/ /____/\__/\__/_/ /_/_/_/\_,_/_//_/_\
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Get the new Palm Tungsten T
> handheld. Power & Color in a compact size!
> http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
>

-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
Received on 2002-12-03