gpt4 book ai didi

php - 解析谷歌日历 XML 提要

转载 作者:可可西里 更新时间:2023-11-01 13:09:05 25 4
gpt4 key购买 nike

我有来自公共(public)谷歌日历的 XML 提要。看起来像这样:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='................' xmlns:gd='http://schemas.google.com/g/2005'>
<id>http://www.google.com/calendar/feeds/........./public/full</id>
<updated>2009-08-24T10:57:00.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/>
<title type='text'>Sports Events</title>
.....
<entry>
<id>...........</id>
<published>2009-08-14T00:29:58.000Z</published>
<updated>2009-08-14T00:29:58.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/>
..............
<georss:where>
<gml:Point>
<gml:pos>11.111111 -22.22222</gml:pos>
</gml:Point>
</georss:where>
<gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'/>
<gd:transparency value='http://schemas.google.com/g/2005#event.transparent'/>
<gCal:uid value='.........@google.com'/>
<gCal:sequence value='0'/>
<gd:when startTime='2009-10-03' endTime='2009-10-04'/>

.............

现在是PHP:

$calendar = simplexml_load_file('http://my.feed.com');
foreach ($calendar->entry as $item) {
//here I get the whole <entry> node
$gd = $item->children('http://schemas.google.com/g/2005');
// now in $gd I have all nodes like <gd:XXXXX>
}

问题是如何从这里获取值(value)?

<gml:pos>11.111111 -22.22222</gml:pos>

它不存在于我的 $gd 变量中,如何获取该节点?

最佳答案

我强烈推荐使用这个库:https://github.com/collegeman/coreylib .这将使一切从开始到结束都变得非常容易。

关于php - 解析谷歌日历 XML 提要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1347033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com