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.
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):
curl supports BasicAuth. Check this example: http://www.jellyandcustard.com/2006/01/02/php-curl-http-put-ssl-and-basic-authentication/
That won't prompt the visitor, thats simply a how-to in terms of getting PHP to log into a website that has Basic Auth enabled, not for serving visitors with a prompt.
so you actually want to prompt the user? Check this out: http://us2.php.net/manual/en/features.http-auth.php