Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php simplexml_load_file(),具有受密码保护的url_Php_Simplexml_Http Authentication - Fatal编程技术网

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

在此处找到相同的答案:。不幸的是,它对我不起作用。