Google Contacts API - 选择事件数据
我试图根据谷歌联系人“事件”(即:周年纪念日等)获取信息“他们似乎将它们称为“事件””。
尽管如此。我已经能够以缩短的清理格式获得一些数据。 这是我用来获取此信息的 XML。
[13] => Zend_Gdat
a_App_Extension_Element Object
(
[_rootElement:protected] => event
[_extensionElements:protected] => Array
(
[0] => Zend_Gdata_App_Extension_Element Object (
[_rootElement:protected] => when
[_extensionAttributes:protected] => Array (
[startTime] => Array (
[namespaceUri] =>
[name] => startTime
[value] => 2009-05-09))
[_text:protected] =>
)
)
[_extensionAttributes:protected] => Array (
[rel] => Array (
[namespaceUri] =>
[name] => rel
[value] => anniversary ))
[_text:protected] =>
)
那么到目前为止,我为获取事件类型所做的工作是使用此代码。
// Get All Events
foreach ($xml->event as $e) {
if($e['rel'] == "anniversary") {
// echo "This is true, this is anniversary";
}
}
并获取实际的Event VALUE(开始时间)。我想我会在 foreach 循环中使用类似的东西。
foreach ($xml->event as $e) {
echo $e->when['startTime'];
}
但这只是回显 NULL。 我尝试了很多变化,但似乎无法实现,尽管我不确定这是否只是因为我过度疲劳。任何帮助将不胜感激!
I am trying to obtain information based on the google contacts "events" (ie: anniversary's etct) "they seem to reference them as 'events'".
So none-the-less. I have been able to obtain some of the data in a shortened cleaned up format.
This is the XML that I am working with to obtain this information.
[13] => Zend_Gdat
a_App_Extension_Element Object
(
[_rootElement:protected] => event
[_extensionElements:protected] => Array
(
[0] => Zend_Gdata_App_Extension_Element Object (
[_rootElement:protected] => when
[_extensionAttributes:protected] => Array (
[startTime] => Array (
[namespaceUri] =>
[name] => startTime
[value] => 2009-05-09))
[_text:protected] =>
)
)
[_extensionAttributes:protected] => Array (
[rel] => Array (
[namespaceUri] =>
[name] => rel
[value] => anniversary ))
[_text:protected] =>
)
So what I have done to obtain the TYPE of EVENT I use this code so far.
// Get All Events
foreach ($xml->event as $e) {
if($e['rel'] == "anniversary") {
// echo "This is true, this is anniversary";
}
}
And to Obtain the actual Event VALUE (the start Time). I THOUGHT I would use something like this running inside the for each loop.
foreach ($xml->event as $e) {
echo $e->when['startTime'];
}
But this just echo's NULL.
I have tried many variations and can't seem to get it, although I'm not sure if it's just due to my over-tiredness. Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案。
I was able to find a solution.