cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-and-php mailing list Archives

Re: JavaScript Cookie

From: Mindaugas Lipskas <manxp_at_freemail.lt>
Date: Thu, 21 May 2009 14:48:27 +0300

Holy crap, it seems to be working! I will need to make some more tests to be sure :)
  ----- Original Message -----
  From: Liu Shan Shui
  To: 'curl with PHP'
  Sent: Thursday, May 21, 2009 2:17 PM
  Subject: RE: JavaScript Cookie

  Hi Mindaugas,

   

  Try parsing out the name and value of each cookie from the JS code and set it in the request header by using the CURLOPT_COOKIE option.

  http://sg.php.net/manual/en/function.curl-setopt.php#10904

   

  With regards,

  Liu Shan Shui

  me_at_lx.sg

  "Life would be much easier if I had the source code." - Anonymous

   

  From: curl-and-php-bounces_at_cool.haxx.se [mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Mindaugas Lipskas
  Sent: Thursday, May 21, 2009 7:03 PM
  To: curl-and-php_at_cool.haxx.se
  Subject: JavaScript Cookie

   

  I'm using curl for one site to automate basic server management tasks. The problem is, that site uses Javascript function to setup cookie after logging on. if cookie is not set, nothing works.

   

   

  And curl for PHP doesn't support javascript, so it's natural I can't get script working. Is there any way to fix it?

   

   

  Here is JS function (used on site) to create cookie:

   

   

  function SetCookie( name, value, expires, path, domain, secure ) {
   var today = new Date();
   today.setTime( today.getTime() );
   if ( expires ) {
    expires = expires * 1000 * 60 * 60 * 24;
   }
   var expires_date = new Date( today.getTime() + (expires) );
   document.cookie = name+'='+escape( value ) +
    ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
    ( ( path ) ? ';path=' + path : '' ) +
    ( ( domain ) ? ';domain=' + domain : '' ) +
    ( ( secure ) ? ';secure' : '' );
  }

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

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

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-05-21

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET