I am sure, somebody will point you to the right direction here. -Pradeep
"[ Muliawan Sjarif ]" <[EMAIL PROTECTED]> wrote: Hi, Thank you for your reply. Actually I did try authorization_basic. But, it seems that the website doesn't use authorization_basic scheme. Below is my code. The username & password are real. I create them for testing purpose. I'd really appreciate it if you could verify the code and let me know what's wrong. I have no problem at all when authenticating against HTTP protocol -- of course, everybody can do this. I'm wondering, is there any other method of authentication on HTTPS that is supported by perl? I'm not sure if www_authenticate works though. Besides, I can't fetch the realm name of the website. Can authentication against secure websites be automated from script? Muliawan. #!/usr/bin/perl use warnings; use strict; use Digest::MD5; use LWP; use LWP::Debug '-'; # debug mode active use URI::URL; use HTTP::Cookies::Mozilla; use HTTP::Request::Common; use HTTP::Headers; my($statement_URL,$hdr,$server_response); $statement_URL="https://scgi.half.ebay.com/saw-cgi/eBayISAPI.dll"; $hdr="MfcISAPICommand=SignInWelcome&siteid=20&co_partnerId=2&UsingSSL=1&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=1106"; $server_response=&browse($statement_URL,$hdr,'POST'); #print $server_response; sub browse(){ my($statement_URL,$hdr,$method)[EMAIL PROTECTED]; my($content_type,$response); $content_type = "application/x-www-form-urlencoded"; open(NEWFILE, ">login.html"); my($ua) = new LWP::UserAgent; $ua->agent("libwww-perl/5.65"); my($cookie) = new HTTP::Cookies::Mozilla(File => 'mycookies.txt', autosave => 1, ignore_discard => 1); $ua->cookie_jar($cookie); # my($encoded)=''; # my($md5) = new Digest::MD5; # $md5->add('mysheriff', 'mypassword'); # $encoded = $md5->b64digest; my($headers) = new HTTP::Headers('Content-Type' => $content_type, Date => HTTP::Date::time2str(time), Accept => 'text/html'); $headers->authorization_basic('mysheriff','mypassword'); my($url)= new URI::URL($statement_URL); my($request); $request = new HTTP::Request($method, $url, $headers, $hdr); print "\n\nprocessing URL: ".$url."\n\n"; $cookie->add_cookie_header($request); $response = $ua->request($request); $cookie->extract_cookies($response); my($reply); if ($response->is_success){ $reply=$response->content; print NEWFILE $reply; } else { $reply=$response->error_as_HTML(); print $reply . "\n"; } return $reply; } >From: Pradeep Sethi >Reply-To: [EMAIL PROTECTED] >To: "\[ Muliawan Sjarif \]" >Subject: Re: need advice - https authentication >Date: Tue, 17 Jun 2003 19:42:46 +0100 (BST) > >Hi, > >if you are using perl, you can set authentication in the header > >perldoc Http::Headers > > > $h->authorization_basic > This method is used to get or set an authorization header that use > the "Basic Authentication Scheme". In array context it will return > two values; the user name and the password. In scalar context it > will return *"uname:password"* as a single string value. > When used to set the header value, it expects two arguments. >*E.g.*: > $h->authorization_basic($uname, $password); > > _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus SMS using the Yahoo! Messenger;Download latest version.