例如,这里有一个URL:https://rexms.net:32005/rexwapi/common/timesframes - 如果我在浏览器中输入该URL,请输入正确的用户名/密码,它将向我吐出XML.问题是我需要通过PHP访问它,所以我显然没有得到输入用户名/密码的提示.
目前的代码是:
$timeframes_xml = simplexml_load_file(file_get_contents('https://rexms.net:32005/rexwapi/common/timeframes'));
Run Code Online (Sandbox Code Playgroud)
我想你可以简单地使用
https://username:password@rexms.net:32005/rexwapi/common/timeframes
Run Code Online (Sandbox Code Playgroud)