Thursday, November 7, 2013

How to fetch contacts from yahoo account

It is been a tough job now-a-days to fetch contact details from yahoo account. I was struggling for days to fetch the emails from my own yahoo account using yahoo api, then after several days finally got the success. So as i was struggling for long, may be possible there are people like me also finding it hard to get emails, so i thought of sharing the whole process here.

Simple steps to fetch contact details

1. Create a yahoo application by visiting http://developer.yahoo.com. Get application ID, its secret key and consumer key. Make sure while creating your application, you provide the correct domain name on which you will use this module.

2. Download the complete working module for this from our git repository. Create a folder named Yahoo, put the repository content in this folder, then put folder Yahoo in your root directory.

Easy so far.

3. Update your application's ID, its secret key, domain name which you specified at the time of creation of your yahoo app, and consumer key in common.inc.php file under email folder.

Done ?

4. Run http://Your_Domain/Yahoo/email/simpleauth.php in your browser.

And we are done, emails of your contacts are on your screen.
If you need complete profile, then uncomment "print_r($profile);" in file simpleauth.php. And fetch whatever you want from this array.

Hope this helped. Thanks. Any query is most welcomed.
When a developer start using Facebook Graph API  first thing that comes to his mind is authentication by Facebook. Most popular word used is Facebook documentation for this is access token.

What is access token?
Why i need it?
What is its purpose?
These are the common question comes to developers mind when he/she heard about this world.

Facebook implementation of the OAuth 2.0 involves three different steps:-1. User authentication, 2. App authorization and 3. App authentication. User authentication ensures that the user is who they say they are. App authorization ensures that the user knows exactly what data and capabilities they are providing to your app. App authentication ensures that the user is giving their information to your app and not someone else. Once these steps are complete, your app is issued an user access token that you enables you to access the user's information and take actions on their behalf.

How to get access token by PHP SDK ?
$facebook = new Facebook(array(
            'appId' => APP_ID,
            'secret' => APP_SECRET,
          )); 
$facebook->getAccessToken();
How to get extend it ? PHP sdk 3.2.2 provides inbuilt method to extend access token to 60 days validity. The function name is setExtendedAccessToken, and it destroys the session afterwards, to remove the risk of having two active sessions. Also, the function no longer actually returns the token, but instead stores it within the persistant data. You can therefore get the new access token with the public function getAccessToken afterwards.  Grab the new SDK from official Facebook PHP SDK github page to make sure you're up to date. 
$facebook->setExtendedAccessToken();
$facebook->getAccessToken();
Access token Debugging
Debug online https://developers.facebook.com/tools/debug Debug by api
GET /debug_token?
     input_token={input-token}&
     access_token={access-token}

https://developers.facebook.com/docs/facebook-login/access-tokens/#debug

How to handle expired tokens


Official documentation have some good resources to explain this.
https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/

More about tokens

https://developers.facebook.com/docs/facebook-login/access-tokens/




 

© 2013 Responsive Testing Blog. All rights resevered. Designed by CodeToHack

Back To Top