PierreL has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to authentificate on a StockEchange site with LWP. I am using all the tools of LWP, including cookies, but I receive a page which shows that my browser do not accept cookies. I have tried too to change to change name of the agent, but I get the same result. Any idea? Pierre

Replies are listed 'Best First'.
Re: lwp autentification
by tachyon-II (Chaplain) on Apr 22, 2008 at 12:32 UTC

    Does this work at your site? It certainly works on the test server at cornell. Note this server comes up if you are feeling lucky and Google for 'basic authentication test site' so it seems fair enough to leave the details in the script.

    use LWP::UserAgent; my $url = "http://prism.library.cornell.edu/control/authBasic/authTest +/"; my ($servername) = $url =~ m!://([^/]+)!; my $port = 80; my $realm = 'User: test Pass:'; my $username = 'test'; my $password = 'this'; my $lwp = LWP::UserAgent->new( ); $lwp->cookie_jar( {} ); $lwp->credentials("$servername:$port", $realm, $username, $password); my $response = $lwp->get($url); print $response->as_string;
      I found an '404 not found' when doing this program. I tried to add 445 as port on my own program, but it doestn't help.
      In my own site, it is not this kind of identification, but I must tape this user name on keyboard, and click on a virtual numerical keyboard for password.
        Sorry, this program is working, my very fault
Re: lwp autentification
by Anonymous Monk on Apr 22, 2008 at 10:53 UTC
    Try WWW::Mechanize, makes it a little easier.