通过PHP脚本进行CGI身份验证?

时间:2011-11-07 13:22:25

标签: php authentication http-authentication

我试图找出是否有任何方法可以使用某些CGI脚本进行身份验证。我希望我的脚本能够获取位于adress.com/admin.cgi?mode=viewxml上的XML但需要用户身份验证,因此网站会提示我使用HTTP Auth窗口,当我输入凭据时,提到的页面是可查看的,因此我可以轻松使用XML。

1 个答案:

答案 0 :(得分:0)

使用以下语法:http://user:password@hostname/path

$user = 'Stackoverflow';
$password = 'Password';

$url = "http://$user:$password@adress.com/admin.cgi?mode=viewxml