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

Hi, I have had a look at the relevant questions in this area on the site but have found that they do not help me. So far I have a script that can connect to a web site using either HTTP or HTTPS on whatever port and (so far) just dumps the response to STDOUT. I have had a play with the snippets I have been able to find to process the basic authentication, but no joy. Most of the examples use a get first (I think this would just be for forms though) and then print the auth credentials to the sock session. I am pretty sure it should be a POST though. Any chance of some help here... quick and dirty is cool. Cheers, Helen

Replies are listed 'Best First'.
Re: HTTP Basic Authentication
by cacharbe (Curate) on Dec 05, 2001 at 18:21 UTC
    Can you tell us what the page you are trying to post to looks like - That is, are you sure you need auth_basic, or do you need to post the username and pwd to the page? An example of the code you have tried and what you are seeing when it fails? etc...

    When you say that you have tried most of the snippets around PM and they didn't work, most of them DO work (for their given process). So, when you are seeing something you can't exaplain or that seems impossible, you need to check your assumptions.

    C-.

(ichimunki) Re: HTTP Basic Authentication
by ichimunki (Priest) on Dec 05, 2001 at 20:49 UTC
    You're not telling us very much that we need to know to help you out. Are you using LWP to handle the connections? IIRC that module handles basic HTTP authentication and cookies quite well. When you say "sock session" I get the impression you are doing socket level work yourself, which is definitely a big waste of time if you are connecting to standard web servers. It would be helpful if you gave us the error messages you are getting and snippets of your script.