开发者

Password protected page, how to access it with PHP?

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:

  1. Go to the password protected URL
  2. Enter the username
  3. Enter the password
  4. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜