Gmail Contact Grabber – Php class

Gmail Contact Grabber Php Class

Gmail Contact Grabber Php Class

Most of the social media websites have the facility to fetch the contacts in our address book. This is probably being used to find friends network. This is a simple php class based on Google’s client login API to fetch contact details someone’s gmail Id. Curl must be enabled in your server for the proper working of this library. You should also need to register your application to Google for authentication which is very simple and includes only two steps.
The following link helps you to register the website.

https://www.google.com/accounts/ManageDomains

If you require more information about Google Client Login API click here

To download the class file click here

Following sample code snipplet shows How to use the Gmail Contact Grabber library.

 
<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
 
 
include "Gmail_contacts.php";
if( isset( $_POST['email_submit']) )
{
 
   // First parameter is the offset 
   // Second parameter is the starting index. 
 
   $grabber = new Gmail_contacts(1000, 1 );
   $emails = $grabber->get_contacts( $_POST['email'] , $_POST['password'] );
 
}
 
 
?>
 
 
 
 
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
 
    Email:  <input type="text" name="email" /> <br>
    Password: <input type="password"  name="password" />
    <br>
    <input type="submit" name="email_submit" />
 
</form>
 
 
<?php if( isset( $emails ) && count($emails) > 0  ): ?>
<?php foreach(  $emails as $email ): ?>
 
<input type="checkbox" name="conttact[]" value="<?=$email['email'];?>" /> <?=$email['email'];?><br>
 
<?php endforeach;?>
 
<?php endif; ?>

16 Responses to “Gmail Contact Grabber – Php class”

  1. Vasudev says:

    Awesome scripts.
    Thanks

  2. Ankan says:

    after putting username and password it is showing “Access forbidden!,Error 403″. pls help me….

  3. Sarath D R says:

    Did you register your website with google?

  4. Sarath D R says:

    Thanks vasudev!!

  5. kilotto says:

    Great!

  6. robert says:

    Hello, cant make the script work, $response = curl_exec($ch); returns false, what could be wrong? please help

  7. Sarath D R says:

    Did you register with Google ??

  8. robert says:

    i didnt register, because i am running this script on localhost.. hmm :)

  9. Sarath D R says:

    It wont work in localhost …You have to upload to the domain.

  10. Rahul Sharma says:

    The script is awesome and very helpful.

    But I also want to show error messages if authentication failed like if user enter wrong email or password.

    Please help me on this

  11. Iqbal hussian says:

    how to grab email from only email address and that email address’s address book?? any idea like facebook they sends email to registered email’s address book emails

  12. Carlos says:

    This script works ….. What is the script for yahoo and hotmail?

    este script funciona….. ¿cual es el script para yahoo y hotmail?

  13. Ebot Tabi says:

    Hi nice script, perfect working well on localhost, good for integration with Kohana 2.3 and Kohana 3. any plans for a yahoo script will be helpful for me, will definitely keep an eagle eye on your articles.

    thanks

  14. anuraj says:

    how can i sent group scrap in orkut

  15. james bond says:

    thanx for nice script

  16. halfsaint says:

    Respected,

    i used your code in my website but its not working properly. its always return NULL when i login and grant permission.
    please help me…


Leave a Reply

Copyright © 2012 Mesmerizing Moments | sarathdr.com.