SOAP Without Netscape Cookie File

| | Comments (0)
If the SOAP example I gave doesn't authenticate properly, try providing your own cookie instead of reading from an existing cookie file.

use Digest::MD5 'md5_hex';
 
my $cookie = HTTP::Cookies->new;
$cookie->set_cookie(0, user => bakeUserCookie($uid, $pass), '/', $host);
 
sub bakeUserCookie {
    my($uid, $passwd) = @_;
    my $cookie = $uid . '::' . md5_hex($passwd);
    $cookie =~ s/(.)/sprintf("%%%02x", ord($1))/ge;
    $cookie =~ s/%/%25/g;
    return $cookie;
}

use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on March 12, 2002 5:08 AM.

Mac::Glues on Mac OS X was the previous entry in this site.

Terrorists #1 and #2, Your Visas Are Ready is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.