PHP Classes

Google contact offline

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  Google OAuth Offline ...  >  All threads  >  Google contact offline  >  (Un) Subscribe thread alerts  
Subject:Google contact offline
Summary:Google contact offline
Messages:3
Author:shirish
Date:2015-07-08 13:26:10
Update:2015-07-13 18:07:10
 

  1. Google contact offline   Reply   Report abuse  
Picture of shirish shirish - 2015-07-08 19:43:58
Thanks, now I got the idea of google offline access api call. As it is used for accessing user profile. I need users contacts list offline.
Will you please tell me what changes I have take for google contact offline api call.

  2. Re: Google contact offline   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-07-08 21:11:40 - In reply to message 1 from shirish
Sure, you need to follow several steps:

1. Go to Google API console and create a project if you do not have created one. In that case go to the API credentials and create a client ID.

console.developers.google.com/

2. In the APIs menu find and enable the Contacts API

3. You can take as basis the login_with_google.php for your application. Set the client_id and client_secret to the values obtained in step 1.

4. In the scope you need to append the value "https://www.google.com/m8/feeds" or "https://www.googleapis.com/auth/contacts.readonly" depending if you want to change the user contacts or not. If you just want to obtain the contacts, use the last value. If you have other permissions values in the scope, make sure each one is separated by a space.

5. Now to get the contacts of the current user you need to send an API call with CallAPI using the URL https://www.google.com/m8/feeds/contacts/default/full . If you want to get the contacts of some other user, replace default by the email of that user.

6. This call will return a XML feed. The CallAPI function can decode the XML for you and return an object instead of XML string if you add these values to the $options parameter: 'DecodeXMLResponse'=>'simplexml', 'ResponseContentType'=>'text/xml' .

The last parameter will return an object structure will all the contacts of the give user.

  3. Re: Google contact offline   Reply   Report abuse  
Picture of shirish shirish - 2015-07-13 18:07:10 - In reply to message 1 from shirish
Thanks Manuel, you have solved my issue. Thanks a lot.