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 提要。
有什么建议吗?
这是在单个页面上运行的代码输出的屏幕截图。