php authentication

Discussion in 'PHP' started by goodmast3r, Aug 22, 2009.

  1. #1
    anyone how to access url that has HTTP basic authentication using PHP? When we enter the url in browser, it will prompt username and password. Thanks.
     
    goodmast3r, Aug 22, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The "prompt" is basically HTTP Basic Auth, its not a PHP thing but rather a webserver thing.

    More information setting up mod_auth with apache and .htaccess

    http://httpd.apache.org/docs/2.0/howto/auth.html

    A very basic example (in an .htaccess file in the desired protected folder) :
    
    AuthType Basic
    AuthName "Restricted Access"
    AuthUserFile "/link/to/password/file/genetated/by/htpasswd/passwd"
    require valid-user
    
    Code (markup):
     
    kblessinggr, Aug 22, 2009 IP
  3. aquilax

    aquilax Member

    Messages:
    126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    33
    #3
    aquilax, Aug 22, 2009 IP
  4. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    kblessinggr, Aug 23, 2009 IP
  5. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Kyosys, Aug 23, 2009 IP