title: List all contacts in a table with JSON
body: <p>I'm currently using this function to get all my contacts from Google Contacts.</p>
  
  <pre><code>session_start();
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/accounts/ClientLogin');
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  
  $data = array(
      'accountType' =&gt; 'GOOGLE',
      'Email' =&gt; 'email',
      'Passwd' =&gt; 'password',
      'source'=&gt;'sourcetest',
      'service'=&gt;'cp'
  );
  
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  
  
  $responses = explode("\n", curl_exec($ch));
  $_SESSION['auth'] = str_replace('Auth=', '', $responses[2]);
  $_SESSION['email'] = 'email';
  
  
  
  $url = 'https://www.google.com/m8/feeds/contacts/default/full';
  $url .= '?group=http://www.google.com/m8/feeds/groups/'.$_SESSION['email'].'/base/6';
  $url .= '&amp;max-results=500&amp;alt=json';
  
  $ch = curl_init($url);
  
  $header[] = 'Authorization: GoogleLogin auth='.$_SESSION['auth'];
  $header[] = 'GData-Version: 3.0';
  
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HEADER, false);
  
  $response = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>To print the whole JSON works fine with <code>echo $respone;</code> but I don't know how to list all of the contacts (full name, phone and image/avatar) in a table. I have tried <code>json_decode()</code> and even Google'd for a solution for a few days now with no result.</p>
  
  <p>I'm asking you know - how can I fix this?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>Array
  (
      [version] =&gt; 1.0
      [encoding] =&gt; UTF-8
      [feed] =&gt; Array
          (
              [xmlns] =&gt; http://www.w3.org/2005/Atom
              [xmlns$openSearch] =&gt; http://a9.com/-/spec/opensearch/1.1/
              [xmlns$gContact] =&gt; http://schemas.google.com/contact/2008
              [xmlns$batch] =&gt; http://schemas.google.com/gdata/batch
              [xmlns$gd] =&gt; http://schemas.google.com/g/2005
              [gd$etag] =&gt; W/"{code}"
              [id] =&gt; Array
                  (
                      [$t] =&gt; mymail@gmail.com
                  )
  
              [updated] =&gt; Array
                  (
                      [$t] =&gt; 2011-11-07T13:50:54.073Z
                  )
  
              [category] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [scheme] =&gt; http://schemas.google.com/g/2005#kind
                              [term] =&gt; http://schemas.google.com/contact/2008#contact
                          )
  
                  )
  
              [title] =&gt; Array
                  (
                      [$t] =&gt; edgren's Contacts
                  )
  
              [link] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [rel] =&gt; alternate
                              [type] =&gt; text/html
                              [href] =&gt; http://www.google.com/
                          )
  
                      [1] =&gt; Array
                          (
                              [rel] =&gt; http://schemas.google.com/g/2005#feed
                              [type] =&gt; application/atom+xml
                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full
                          )
  
                      [2] =&gt; Array
                          (
                              [rel] =&gt; http://schemas.google.com/g/2005#post
                              [type] =&gt; application/atom+xml
                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full
                          )
  
                      [3] =&gt; Array
                          (
                              [rel] =&gt; http://schemas.google.com/g/2005#batch
                              [type] =&gt; application/atom+xml
                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full/batch
                          )
  
                      [4] =&gt; Array
                          (
                              [rel] =&gt; self
                              [type] =&gt; application/atom+xml
                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full?alt=json&amp;max-results=500&amp;group=http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2Fgroups%2Fmymail%40gmail.com%2Fbase%2F6
                          )
  
                  )
  
              [author] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [name] =&gt; Array
                                  (
                                      [$t] =&gt; edgren
                                  )
  
                              [email] =&gt; Array
                                  (
                                      [$t] =&gt; mymail@gmail.com
                                  )
  
                          )
  
                  )
  
              [generator] =&gt; Array
                  (
                      [version] =&gt; 1.0
                      [uri] =&gt; http://www.google.com/m8/feeds
                      [$t] =&gt; Contacts
                  )
  
              [openSearch$totalResults] =&gt; Array
                  (
                      [$t] =&gt; 73
                  )
  
              [openSearch$startIndex] =&gt; Array
                  (
                      [$t] =&gt; 1
                  )
  
              [openSearch$itemsPerPage] =&gt; Array
                  (
                      [$t] =&gt; 500
                  )
  
              [entry] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [gd$etag] =&gt; "{code}"
                              [id] =&gt; Array
                                  (
                                      [$t] =&gt; http://www.google.com/m8/feeds/contacts/mymail%40gmail.com/base/{code}
                                  )
  
                              [updated] =&gt; Array
                                  (
                                      [$t] =&gt; 2011-09-12T17:28:57.835Z
                                  )
  
                              [app$edited] =&gt; Array
                                  (
                                      [xmlns$app] =&gt; http://www.w3.org/2007/app
                                      [$t] =&gt; 2011-09-12T17:28:57.835Z
                                  )
  
                              [category] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                              [scheme] =&gt; http://schemas.google.com/g/2005#kind
                                              [term] =&gt; http://schemas.google.com/contact/2008#contact
                                          )
  
                                  )
  
                              [title] =&gt; Array
                                  (
                                      [$t] =&gt; {contacts name}
                                  )
  
                              [link] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                              [rel] =&gt; http://schemas.google.com/contacts/2008/rel#photo
                                              [type] =&gt; image/*
                                              [href] =&gt; https://www.google.com/m8/feeds/photos/media/mymail%40gmail.com/{code}
                                              [gd$etag] =&gt; "{code}"
                                          )
  
                                      [1] =&gt; Array
                                          (
                                              [rel] =&gt; self
                                              [type] =&gt; application/atom+xml
                                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full/{code}
                                          )
  
                                      [2] =&gt; Array
                                          (
                                              [rel] =&gt; edit
                                              [type] =&gt; application/atom+xml
                                              [href] =&gt; https://www.google.com/m8/feeds/contacts/mymail%40gmail.com/full/{code}
                                          )
  
                                  )
  
                              [gd$name] =&gt; Array
                                  (
                                      [gd$fullName] =&gt; Array
                                          (
                                              [$t] =&gt; {contacts name}
                                          )
  
                                      [gd$givenName] =&gt; Array
                                          (
                                              [$t] =&gt; {contacts last name}
                                          )
  
                                      [gd$familyName] =&gt; Array
                                          (
                                              [$t] =&gt; {contacts first name}
                                          )
  
                                  )
  
                              [gContact$birthday] =&gt; Array
                                  (
                                      [when] =&gt; {contacts birthday}
                                  )
  
                              [gd$email] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                              [rel] =&gt; http://schemas.google.com/g/2005#other
                                              [address] =&gt; {contacts email}
                                              [primary] =&gt; true
                                          )
  
                                  )
  
                              [gd$phoneNumber] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                              [rel] =&gt; http://schemas.google.com/g/2005#mobile
                                              [$t] =&gt; {contacts number}
                                          )
  
                                  )
  
                              [gd$structuredPostalAddress] =&gt; Array
                                  (
                                      [0] =&gt; Array
                                          (
                                              [rel] =&gt; http://schemas.google.com/g/2005#home
                                              [gd$formattedAddress] =&gt; Array
                                                  (
                                                      [$t] =&gt; {contacts address}
                                                  )
  
                                              [gd$street] =&gt; Array
                                                  (
                                                      [$t] =&gt; {contacts address}
                                                  )
  
                                              [gd$postcode] =&gt; Array
                                                  (
                                                      [$t] =&gt; {contacts address}
                                                  )
  
                                              [gd$city] =&gt; Array
                                                  (
                                                      [$t] =&gt; {contacts address}
                                                  )
  
                                              [gd$region] =&gt; Array
                                                  (
                                                      [$t] =&gt; {contacts address}
                                                  )
  
                                              [gd$country] =&gt; Array
                                                  (
                                                      [code] =&gt; SE
                                                      [$t] =&gt; Sverige
                                                  )
  
                                          )
  
                                  )
  
                              [gContact$website] =&gt; Array
                                  (
                                      [0] =&gt; Array
  
  
          (
                                          [href] =&gt; {contacts website}
                                          [rel] =&gt; profile
                                      )
  
                              )
  
                          [gd$extendedProperty] =&gt; Array
                              (
                                  [0] =&gt; Array
                                      (
                                          [name] =&gt; workAddrTB
                                          [value] =&gt; WorkAddress2=/WorkCity=/WorkState=/WorkZipCode=/WorkCountry=
                                      )
  
                                  [1] =&gt; Array
                                      (
                                          [name] =&gt; homeAddrTB
                                          [value] =&gt; HomeAddress2=/HomeCity=/HomeState=/HomeCountry=Sverige/HomeZipCode=
                                      )
  
                                  [2] =&gt; Array
                                      (
                                          [name] =&gt; contactTB
                                          [value] =&gt; PreferMailFormat=0/allowRemoteContent=
                                      )
  
                              )
  
                          [gContact$groupMembershipInfo] =&gt; Array
                              (
                                  [0] =&gt; Array
                                      (
                                          [deleted] =&gt; false
                                          [href] =&gt; http://www.google.com/m8/feeds/groups/mymail%40gmail.com/base/6
                                      )
  
                                  [1] =&gt; Array
                                      (
                                          [deleted] =&gt; false
                                          [href] =&gt; http://www.google.com/m8/feeds/groups/mymail%40gmail.com/base/d
                                      )
  
                              )
  
                      )
  </code></pre>