当前位置首页 > 软件编程 > PHP教程 > 关于 php:file_get_content 不适用于特定链接

关于 php:file_get_content 不适用于特定链接

file_get_content is not working for a specific link

我正面临一个非常复杂的情况,我有两个 URL 从中读取 XML 内容。下面是我的简单脚本。

1
2
3
4
5
6
7
8
9
$a1 = file_get_contents('http://xml.propspace.com/feed/xml.php?cl=1678&pid=2323&acc=2323');

var_dump($a1);

echo '';

$a2 = file_get_contents('http://xml.propspace.com/feed/xml.php?cl=1066&pid=9922&acc=1154');

var_dump($a2);

第一个链接 "a1" 存在,但是当我尝试通过 file_get_content 读取 URL 时,它给了我警告。

Warning: file_get_contents(http://xml.propspace.com/feed/xml.php?cl=1678&pid=2323&acc=2323): failed to open stream: HTTP request failed! HTTP/1.1 404 NOT FOUND in serverFilePath/yooy.php on line 2

返回布尔值(假)

和其他链接 "a2" 工作正常并返回 XML 提要。

有什么建议吗?

这是在单个页面上运行的代码输出的屏幕截图。
enter

本文来自网络,不代表菜鸟教程之家立场,转载请注明出处。
返回顶部