使用PHP获取XML文件的内容 [英] Get contents of an XML file using PHP

查看:91
本文介绍了使用PHP获取XML文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

file_get_contents with https?

使用SimpleXML和PHP通过https获取XML内容时遇到的问题

我有以下网址:


其中载入像这样的文件:

Which loads a file like this one:

<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,但这将总是失败。

For some reason my script won't let me get the contents of this file. I'm using the same script as i have been with other URLs but this will always fail.

我的脚本是:

$accom2 = file_get_contents();

print_r($accom2);

我需要为这种类型的网址做些什么?

Is there something I need to do for this type of URL?

推荐答案

可能是一个答案:(如果协议是问题)

probably an answer here: (if protocol is the issue)

file_get_contents with https?

这篇关于使用PHP获取XML文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆