解析从Google DATA API获取的数据

时间:2011-08-31 06:44:58

标签: json google-api

我正在使用Google API来获取我网站上用户的联系人,我使用这样的结果获得了结果,但我希望将联系人从整个网站中删除。

我只是想知道,我怎样才能解析这里的值?

以下是我收到的数据: -

  

   [0]=>   array(7) {
    ["id"]=>
    array(1) {
      ["$t"]=>
      string(83)
"http://www.google.com/m8/feeds/contacts/atiprashant%40gmail.com/base/1213ed0accdb4e"
    }
    ["updated"]=>
    array(1) {
      ["$t"]=>
      string(24) "2011-07-16T06:04:00.610Z"
    }
    ["category"]=>
    array(1) {
      [0]=>
      array(2) {
        ["scheme"]=>
        string(37) "http://schemas.google.com/g/2005#kind"
        ["term"]=>
        string(46) "http://schemas.google.com/contact/2008#contact"
      }
    }
    ["title"]=>
    array(2) {
      ["type"]=>
      string(4) "text"
      ["$t"]=>
      string(22) "ajay kumar yadav RKite"
    }
    ["link"]=>
    array(4) {
      [0]=>
      array(3) {
        ["rel"]=>
        string(54)
"http://schemas.google.com/contacts/2008/rel#edit-photo"
        ["type"]=>
        string(7) "image/"
        ["href"]=>
        string(106)
"https://www.google.com/m8/feeds/photos/media/atiprashant%40gmail.com/1213ed0accdb4e/18unp7AvcGYQW42p1HfLVA"
      }
      [1]=>
      array(3) {
        ["rel"]=>
        string(49) "http://schemas.google.com/contacts/2008/rel#photo"
        ["type"]=>
        string(7) "image/"
        ["href"]=>
        string(83)
"https://www.google.com/m8/feeds/photos/media/atiprashant%40gmail.com/1213ed0accdb4e"
      }
      [2]=>
      array(3) {
        ["rel"]=>
        string(4) "self"
        ["type"]=>
        string(20) "application/atom+xml"
        ["href"]=>
        string(84)
"https://www.google.com/m8/feeds/contacts/atiprashant%40gmail.com/full/1213ed0accdb4e"
      }
      [3]=>
      array(3) {
        ["rel"]=>
        string(4) "edit"
        ["type"]=>
        string(20) "application/atom+xml"
        ["href"]=>
        string(101)
"https://www.google.com/m8/feeds/contacts/atiprashant%40gmail.com/full/1213ed0accdb4e/1310796240610001"
      }
    }
    ["gd$email"]=>
    array(1) {
      [0]=>
      array(3) {
        ["rel"]=>
        string(38) "http://schemas.google.com/g/2005#other"
        ["address"]=>
        string(21) "ajay007iitk@gmail.com"
        ["primary"]=>
        string(4) "true"
      }
    }
    ["gContact$groupMembershipInfo"]=>
    array(1) {
      [0]=>
      array(2) {
        ["deleted"]=>
        string(5) "false"
        ["href"]=>
        string(83)
"http://www.google.com/m8/feeds/groups/atiprashant%40gmail.com/base/3ba9061f0dded52e"
      }
    }   } 

1 个答案:

答案 0 :(得分:2)

您不一定要自己解析它。如果适用于您的环境,您可以使用Google数据库。例如,它具有Java,.NET,PHP,GWT(gwt-gdata),Python等的绑定。请看以下内容: