Something to log/record http-sessions?

I guess this is a bit off-topic, but here goes...

I'm looking for *something* -- maybe a plug-in/extension
to a web-browser (firefox or opera), a stand-alone
program/script emulating a browser, or something
to hook-up to the kernel or network-device -- that
logs the interactions between my web-browser and
a remote server, to screen or file.

I need to know what is recived (not necesserily
full pages or pictures, but file-name and perhaps
the beginning of the page/picture), what is sent
out, where I'm re-directed, cookies, and forms
I send. Whatever it is, must be able to handle
JavaScript (validating and sending forms).

I wish to make a script to automate log-in and
further access to a web-page, but first I need
to find out how the h*** the page detements
wheter or not I'm logged-in and how my log-in
information is sent... So I thought a way to record
my interaction to the site from a normal browser
in some way, would be as good a solution as any.