[英]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 PHP? 假设我有一个用cPanel的目录密码类型的东西(htaccess)密码保护的页面,我怎么能用PHP访问这个页面? So the php script would:
所以php脚本会:
Any help would be greatly appreciated. 任何帮助将不胜感激。
You can set the connection options for CURLOPT_HTTPAUTH
and pass the credentials. 您可以为
CURLOPT_HTTPAUTH
设置连接选项并传递凭据。 There's actually a user comment containing code that should help you get started with Basic Auth. 实际上有一个包含代码的用户评论可以帮助您开始使用Basic Auth。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.