Http Authentication using PHP
There are two easy ways to login to a page protected by htaccess using PHP. You need to have the username and password of course… Anyway, a good use for this is if you want to scrape a page behind an htaccess login, or if you need to do something progammatically behind htaccess password protection.
1) You can access the page as:
http://username:password@domain.com/folder/page.php
2) You can set an extra parameter in curl:
curl_setopt($ch, CURLOPT_USERPWD, “username:password”);
You’re currently reading “ Http Authentication using PHP ,” an entry on BRADINO
- Published:
- 12.7.07 / 7pm
- Category:
- PHP












