This code uses Zend Framework’s Zend_Json::decode method, however you can use json_decode if it is available on your version of PHP.
Create the authorization link
When this link is clicked, the site visitor is presented with a page from Google asking if they would like to allow your application access to their data. If they accept, Google will give them a code, which can then be used on the next request. This is run as an installed application, because there are times when data will be requested without user interaction.
Request an access and refresh token
Use the refresh_token to request a new access_token
Request the contact data
Parse the data from Google
This code also Zend_Gdata to handle the parsing.
This post courtesy of Lyrix, Inc. http://mobiso.com