Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetch Gmail contacts in php

I want to get email ids which are associated to given gmail account. This should be done at local server, I am using xampp server on Windows 7.

I am using below link to get gmail contacts.

https://www.design19.org/blog/import-google-contacts-with-php-or-javascript-using-google-contacts-api-and-oauth-2-0/

Below steps I have done:

  1. created project on google and also activate contact api.

  2. paste client_id and client_secret_id.

  3. google_redirect_uri ='http://localhost';

Problem

When ever I clicked on import google contacts button it redirect me to login page of google to Choose an account for login, after login site ask me to Allow Contact shares to do this?"

After clicking on allow button it redirect me to xampp's default index page http://localhost/dashboard/ because in google app's redirect url I have set http://localhost.

I tried to set redirect url to contact api of google as per my files programs path but it not allowed me to use / so I have set it to :http://localhost in place of http://localhost/contacts/index.php

So where can I see response which I got from google contact api ?

like image 690
Amit Joshi Avatar asked Jul 26 '17 11:07

Amit Joshi


Video Answer


1 Answers

Please find below mentioned steps.

Step 1:

In your localhost application you need to set redirect URL as http://localhost/contacts/index.php

Step 2:

In your Google App you need to add http://localhost/contacts/index.php in Authorizes Redirect URL.

Once you change this settings you can able to redirect on specific page.

Make sure your redirect URL in localhost Client call and In Google App both needs to be same else you will face error.

Let me know if it not works.

like image 173
Shyam Shingadiya Avatar answered Oct 16 '22 04:10

Shyam Shingadiya