php simplexml_load_file(),密码保护网址

Pie*_*rre 4 php simplexml http-authentication

知道答案的人的简单问题......

$xml = simplexml_load_file("http://url/path/file.xml");
Run Code Online (Sandbox Code Playgroud)

此URL .htaccess受保护,如何将登录/密码作为参数传递给函数?

Phl*_*lip 8

$xml = simplexml_load_file("http://username:password@url/path/file.xml");
Run Code Online (Sandbox Code Playgroud)

试试:)