develooper Front page | perl.libwww | Postings from June 2003

Passing the same cookie and headers to a new site

Thread Next
Alan Olegario
June 19, 2003 10:05
Passing the same cookie and headers to a new site
Message ID:
I'm trying to log into a site and then pass the same cookies and headers that are used for the first site into another site.  Should I just be able to do a get to the second site and still maintain the same cookies and headers?

Here's the meat of my code:

foreach $target(@targets) {
        if ($verbose!=0) {print "INFO:  Logging into $target\n"};
        $browser = LWP::UserAgent->new;
        $response = $browser->post(
                        "USER" => $username,
                        "PASSWORD" => $password,

        if ($verbose!=0) {print "RESPONSE\n";}
        if ($verbose!=0) {print $response->as_string;print "\n";}

        if ($verbose!=0) {print "INFO:  Logging into second site\n";}
        $response = $browser->get('');
        if ($verbose!=0) {print "RESPONSE\n";}
        if ($verbose!=0) {print $response->as_string;print "\n";}

Thanks in advance.

Alan Olegario
(P) 646-268-9988
(F) 646-268-9996
(C) 732-501-5212

This message is intended for the named addressee(s) only and contains information that may be confidential, non-public or legally privileged.  If you are not the intended recipient, you must not copy this message or attachment or disclose the contents to any other person.  If you received this email in error, please contact the sender and permanently delete the email and any attachments. Unless expressly stated, opinions in this email are those of the individual sender and not of FX Alliance, LLC or its affiliates.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About