Say I have a page which is password protected with cPanel's directory password type of thing (htaccess), how could I access this page using PH开发者_Python百科P? So the php script would:
- Go to the password protected URL
- Enter the username
- Enter the password
- Return true if it worked, false if it didnt
Any help would be greatly appreciated.
Check out cURL.
You can set the connection options for CURLOPT_HTTPAUTH
and pass the credentials. There's actually a user comment containing code that should help you get started with Basic Auth.
精彩评论