Как разобрать фид контактов Google (XML или JSON) с помощью PHP - PullRequest
1 голос
/ 01 апреля 2011

Я пытаюсь проанализировать фид контактов Google, используя php, ниже приведен пример фида xml, который я получаю от google

<entry>
        <id>http://www.google.com/m8/feeds/contacts/sample%40gmail.com/base/63a9d180dd7f506</id>
        <updated>2010-11-23T10:00:40.848Z</updated>
        <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/>
        <title type='text'>@@@@@@this is the sample title i need to get@@@@@</title>
        <link rel='http://schemas.google.com/contacts/2008/rel#edit-photo' type='image/*' href='@@@@@this is the link i need@@@@@'/>
        <link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/sample40gmail.com/full/680dd7f506'/>
        <link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/sample%40gmail.com/full/0dd7f506/12940848000'/>
        <gd:email rel='http://schemas.google.com/g/2005#other' address='@@@@@@@@here is the address that i need to get@@@@@@@' primary='true'/>
    </entry>

как разобрать ту информацию, которую я пометил с помощью php?

1 Ответ

2 голосов
/ 17 августа 2011

Конвертируйте результат в Json .. (Для простоты разбора)

Вызовите API с параметром "alt = json". Вы получите результаты в формате Json ..

...