Forum OpenACS Q&A: Response to Stupid Aolserver trick with ns_httpget and lynx cookies
to get the Cookie header you can search the output of
ns_conn headersfor "Set-Cookie" headers. Depending on your ACS version there may be more then one of them - my OpenACS 3.2.5 installation returns three at the first request: ad_browser_id, ad_session_id and last_visit; a current OpenACS 4 installation seems to only return one: ad_session_id (which is good, especially if the browser is set up to ask for confirmation for each cookie).
If you want to do more fancy things with forms and session stuff you might want to check out tclwebtest. It is designed to run as stand-alone application from the commandline, but with a little tweaking it might be possible to also run it from within aolserver. It's propably overkill for your task, but I couldn't resist adding a little commercial for it here