This might be what your looking for... Direct from the php manual

http://us2.php.net/features.http-auth