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

Hi monks,

my boss asked me to write a perl skript. That should be able to log on using a https get request (SSL encoded). Within the get request I sen a username and password. After that I receive a session id and two asp coockies. The next step is, to send a https post request, using the two coockies, the sessionid and a secret phrase.
The whole action has to happen within one session. (I mentioned the session id before).
You might say, that their are a bit paranoid. Never the less, gattering this information is legal, of course.
I tried using LWP::UserAgent, HTTP::Request::Common, Net::SSL, LWP::Protocol::https, Crypt::SSLeay, URI::https, HTTP::Request, HTTP::Cookies, HTTP::Headers and LWP::ConnCache.
But I could not use the coockies, nor save them to hard disk.
Providing all the source code, would obviously be to long.
The https requests, etc. are working, but the coockies are really enervating.
Is there is a simple method, how this can be done.
Cheers
Alexander

20050317 Edit by castaway: Changed title from 'How can I store asp coockies'

Replies are listed 'Best First'.
Re: How can I store asp cookies
by holli (Abbot) on Mar 15, 2005 at 17:07 UTC
    In what respect are ASP cookies different from normal ones? However, this sounds like a job for WWW::Mechanize (and Crypt::SSLeay for the SSL-part).


    holli, /regexed monk/
      I tried to install it, but after the installation process was completed sucessfull, I had to figure out, that the requirements are missing, i.E. wrong verion.
      I 'll try it tomorrow again, thank you.
      Alexander
Re: How can I store asp cookies
by JediWizard (Deacon) on Mar 15, 2005 at 17:40 UTC

    The Code below should enable you to store any cookie being set to a file, and enable the user agent to automagically send the cookie back to the server in any appropriate subsequent requests.

    $ua->cookie_jar(HTTP::Cookies->new(file => "/path/to/file", autosave => 1));

    If that doesn't work, I'd advise using something like "PlugProxy" to see exactly what request is going out. This way you can determine conclusively that the cookie is not being sent, which would suprise me (given that you have specified a cookie jar for your ua (unless of course no cookie is actually being set, which PlugProxy could also tell you)).

    Plug Proxy if you want it.

    Also, as holli mentioned, if you are not experienced with LWP::UserAgent and/or http, WWW::Mechanize may be the best way for you to go.


    A truely compassionate attitude towards other does not change, even if they behave negatively or hurt you

    —His Holiness, The Dalai Lama

      This is the way I tried it, but unfortunally the content of the file is just one line:
      #LWP-Cookies-1.0
      There is no information in it, I could use.

        If that is the case I really recomend using plug proxy (mentioned in my last reply) to look at the actualy content of the HTTP request being made, and the response fron the server. If the site is setting a cookie, the you will be able to see it in the response header.

        P.S. I'm sorry if my tone made it sound as if I did not believe you were telling the truth, that was not my intent. I am just telling you they way I would go about solving the problem you are facing.Hopefully something I suggest will help you find the solution.


        A truely compassionate attitude towards other does not change, even if they behave negatively or hurt you

        —His Holiness, The Dalai Lama