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

curl-and-php

RE: JavaScript Cookie

From: Liu Shan Shui <me_at_lx.sg>
Date: Thu, 21 May 2009 19:17:56 +0800

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
Received on 2009-05-21