• Authenticate Apache directory over PHP?
    1 replies, posted
Good day everyone, I am shamelessly reposting this from my SO question by chance that someone on FP would know. I have a directory set up with some Apache Auth stuff. Here is the directory: [url]http://gojalapeno.com/intranet/content/ado-jeune[/url] Use ado-jeune:tezesyrab to login. Here is the code for the .htaccess that powers it: [code] AuthName "Connexion au dossier:" AuthType Basic AuthUserFile "D:\Dropbox\htaccess\secret\.htpasswd" Require valid-user [/code] Now the login form for that directory is generated by the browser, but I wish to use my own HTML form for this. How can I do it? I've tried using cURL with PHP: [code] $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://gojalapeno.com/intranet/content/ado-jeune'); curl_setopt($ch, CURLOPT_USERPWD, 'ado-jeune:tezesyrab'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_exec($ch); curl_close($ch); [/code] That authenticates fine, but the problem with that is that it doesn't redirect to the page (despite the CURLOPT_FOLLOWLOCATION), it merely "includes" it in the current file. As such, all my relative links are broken. So what I'm looking for is a way to use my own HTML form to authenticate to an Apache Basic Auth directory, and to redirect to that directory after. Thanks!
CURL cannot be used for authenticating clients.. Take a look at this: [url]http://php.net/manual/en/features.http-auth.php[/url]
Sorry, you need to Log In to post a reply to this thread.