我试图在远程服务器上打开一个 XML 文件,但我收到一条错误消息,指出已达到重定向限制。我无法控制遥控器,有没有办法可以增加这个限制?或者,我应该与拥有服务器的人交谈,看看他们能做什么?
这是错误:
警告:simplexml_load_file(http://www.server.com/search/music.xml?key=key&type=songs&p1=All%20Things%20New&p2=Elevation%20Worship)[function.simplexml-load-file]:无法打开流:达到重定向限制,在第 4 行的 /home/admin/public_html/art/art.php 中中止
警告:simplexml_load_file() [function.simplexml-load-file]:I/O 警告:未能加载外部实体“ http://www.server.com/search/music.xml?key=key&type=songs&p1=All% 20Things%20New&p2=Elevation%20Worship " 在 /home/admin/public_html/art/art.php 的第 4 行
致命错误:在第 6 行的 /home/admin/public_html/art/art.php 中的非对象上调用成员函数 xpath()
我的代码是:
<?php
function errorHandler($n, $m, $f, $l) {
header('Location: blank.png');
}
set_error_handler('errorHandler');
$url = 'http://REMOTESERVER/search/music.xml?key=KEY&type=songs&p1=' . htmlspecialchars($_GET["track"]) . '&p2=' . htmlspecialchars($_GET["artist"]) . '';
$xml = simplexml_load_file($url);
$img = $xml->xpath('//image200');
$large = (string)$img[0];
header("Location:".urldecode($large));
?>