chuck_norris has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys,

I am trying to perform an HTML request and get the cookies. When running the request on the browser, I get the following cookie:

Cookie:
JSESSIONID=60E57614E7D03180907A5E79C5004010;PCLT=709bbb898f81c961a720d +dca9131ff4f00000000
However, my user agent catches only the first cookie (JSESSIONID) and not the PCLT cookie.
I tried using WWW::Mechanize module but got the same result.
Do you know how can I catch that cookie?
Thanks,
Chuck

Replies are listed 'Best First'.
Re: Cookie Problem
by tachyon-II (Chaplain) on Apr 24, 2008 at 13:05 UTC

    What you are showing is not a server cookie. It is the client side request to the server which sends cookie data back to the server in the form:

    Cookie: NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2 ...

    The server sends multiple cookies in the form:

    Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov- +99 23:12:40 GMT Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/

    When client requests a URL in path "/" on this server, it sends:

    Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001

    If I have a script that sends two Set-Cookie headers I have no problem retreiving them. Perhaps this will work for you. See HTTP::Cookies

Re: Cookie Problem
by bingos (Vicar) on Apr 25, 2008 at 07:43 UTC

    Surely, Chuck Norris would round-house kick the cookie >:)