Forum Moderators: coopster

Message Too Old, No Replies

sending cookie info in custom header

         

jatar_k

9:52 pm on Mar 18, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have to say I am not sure if it is possible. I was wondering if anyone has done it.

Pretty simple, get the content from a url (which I control, nothing shady) and making that url think the cookie exists by sending it info in a custom request. The site in question is jsp and then I would use php to include the info and keep it from bouncing me to the login page because the cookie isn't really there.

I'm not looking for a work around, just an idea of how this could be done or a pointer in the right direction.

Fischerlaender

11:20 pm on Mar 18, 2003 (gmt 0)

10+ Year Member



I'm not sure if I got this one:
Page A checks if a special cookie is set; if it isn't you get redirected to the login page. Is it set, then you are shown the content. You now want to send page A a cookie that isn't really set on your browser?

The only idea I would come up with is to use a local proxy server which puts the custom cookie into your browser's request. I've got a copy of "Java Examples in a Nutshell" from O'Reilly which has several examples of different kinds of servers; this could give you some very helpfull ideas.

jatar_k

11:27 pm on Mar 18, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I will have to look at that.

I actually want to include the content via http/curl in another page on the same site. I want to pass the cookie check though, with out having to change the existing pages.

This all seems very weird but it is a weird situation.

nosanity

12:13 am on Mar 19, 2003 (gmt 0)

10+ Year Member



Although I have not tested this, I did find it on PHP's site. You can use this to return the contents of a cookie, to be used later by cURL.

function AUTH_SITE_COOKIE_STORE($LOGINURL,$POSTFIELDS)
{
$parseURL = parse_url($LOGINURL);

$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "$parseURL[host].cookie");
curl_setopt($ch, CURLOPT_URL,"$LOGINURL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$POSTFIELDS");

ob_start();
curl_exec ($ch);
ob_end_clean();

curl_close ($ch);
return "$parseURL[host].cookie";
}

Take a look at PHP [php.net]'s site under cURL [php.net].

noSanity

jatar_k

7:40 am on Mar 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



nice Jer, thanks

nosanity

8:34 am on Mar 19, 2003 (gmt 0)

10+ Year Member



No prob, Ad.