更新时间:2023-02-23 18:10:31
似乎您正在访问的url中存在一些重定向问题,并且很可能simplexml_load_file()
没有遵循重定向...
Seems like there is some redirection problem in the url you are accessing, and most probably simplexml_load_file()
doesn't follow redirects...
因此解决方案是使用file_get_contents()
或cUrl
...
So the solution would be to use file_get_contents()
or cUrl
...
由于file_get_contents()
更容易,我只显示...
As file_get_contents()
is easier, I am showing that only...
代码必须类似于:
<?php
$xml = simplexml_load_string(file_get_contents('http://example_page.ugu.pl/api/test.xml'));
?>
更多:
<?php
$xml = simplexml_load_string(file_get_contents('http://jakdojade.pl/pages/api/outputs/schedules.xml'));
?>
^那也完全可行!