使用 PHP 获取 XML 文件的内容 [重复]

2024-05-05

可能的重复:
file_get_contents 与 https? https://stackoverflow.com/questions/1975461/file-get-contents-with-https
使用 SimpleXML 和 PHP 通过 https 获取 XML 内容时出现问题 https://stackoverflow.com/questions/11883575/problems-getting-xml-content-via-https-using-simplexml-and-php

我有网址:

它加载一个像这样的文件:

<calendars>
    <calendar accommodation_id="1234567">
        <day date="2012-08-09" vacancy="false" minimum_nights="7" arrival_day="true"/>
        <day date="2012-08-10" vacancy="false" minimum_nights="3" arrival_day="true"/>
        <day date="2012-08-11" vacancy="false" minimum_nights="3" arrival_day="true"/>
        ...
        <day date="2014-01-31" vacancy="true" minimum_nights="3" arrival_day="true"/>
    </calendar>
</calendars>

由于某种原因,我的脚本不允许我获取该文件的内容。我使用与其他 URL 相同的脚本,但这总是会失败。

我的脚本是:

$accom2 = file_get_contents();

print_r($accom2);

对于这种类型的 URL,我需要做些什么吗?


可能是这里的答案:(如果协议是问题)

如何让 file_get_contents() 与 HTTPS 配合使用? https://stackoverflow.com/questions/1975461/file-get-contents-with-https

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 PHP 获取 XML 文件的内容 [重复] 的相关文章

随机推荐