curl-and-php
JavaScript Cookie
Date: Thu, 21 May 2009 14:03:27 +0300
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