开发者

Parsing data obtained from Google DATA API

I am working on a Google API to obtain the contacts of users at my website, and I obtained a result using like this, but I wish wish to have the contacts out of the whole chunk.

I just wanna know , how can I parse values from here ??

Here is the data i received :-

   [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"
      }
    }   } 


You don't necessarily have to parse it yourself. You can just use the Google Data library if it is available for your environment. For instance it has bindings for Java, .NET, PHP, GWT (gwt-gdata), Python, etc. Look at the following:

  • http://code.google.com/apis/gdata/
  • http://code.google.com/apis/gdata/docs/client-libraries.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜