php simplexml_load_file(),具有受密码保护的url
对于知道答案的人来说,这是一个简单的问题php simplexml_load_file(),具有受密码保护的url,php,simplexml,http-authentication,Php,Simplexml,Http Authentication,对于知道答案的人来说,这是一个简单的问题 $xml = simplexml_load_file("http://url/path/file.xml"); 此url受.htaccess保护,如何将登录名/密码作为参数传递给函数?文件获取内容或curl将允许您使用http://username:password@url/path/file.xml 获取字符串数据并传递到simplexml\u load\u string $xml = simplexml_load_file("http://user
$xml = simplexml_load_file("http://url/path/file.xml");
此url受
.htaccess
保护,如何将登录名/密码作为参数传递给函数?文件获取内容
或curl将允许您使用http://username:password@url/path/file.xml
获取字符串数据并传递到simplexml\u load\u string
$xml = simplexml_load_file("http://username:password@url/path/file.xml");
试试看:)必须在php.ini(或propriertary.htaccess)中打开allow\u url\u fopen和allow\u url\u include,然后才能执行此操作。它很可能不是在您的服务器上设置的,必须手动更改 具有这些值的.htaccess设置示例如下:
php_value allow_url_fopen 1
php_value allow_url_include 1
在此处找到相同的答案:。不幸的是,它对我不起作用。