Re: set cookie

"Mindaugas Lipskas" <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <C9DC4DBFBEC34B99A218F869A9AFC456@mindaugas>
I thought of it, but I wasn't sure if it works. Let's try...
  ----- Original Message ----- 
  From: Shanshui Liu 
  To: curl with PHP 
  Sent: Thursday, January 21, 2010 7:25 AM
  Subject: Re: set cookie


  Hi Mindaugas,


  I don't think CURLOPT_COOKIEJAR saves whatever that is in CURLOPT_COOKIE as it only saves incoming cookie headers. Is there a reason why you're not storing "some_text" in cookie.txt directly?

  With regards,
  Liu Shan Shui
  http://lx.sg/
  "Life would be much easier if I had the source code." - Anonymous



  On Thu, Jan 21, 2010 at 3:56 AM, Mindaugas <[email protected]> wrote:

    I need to setup cookie before sending further requests, and my code looks like:





    $cookie="cookie.txt";



    $ch=curl_init();

    curl_setopt($ch, CURLOPT_URL, $url]);

    curl_setopt($ch, CURLOPT_USERAGENT, $agent);

    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);

    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);

    curl_setopt($ch, CURLOPT_COOKIE, "some_text");

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    $post=curl_exec($ch);

    curl_close($ch);





    When I run this code, file “cookie.txt” remains empty. Isn’t curl supposed to write “some_text” to cookie.txt file when code is launched? Or is my code wrong?


    _______________________________________________
    http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php






------------------------------------------------------------------------------


  _______________________________________________
  http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.