require 'Google/autoload.php'; // Set your credentials $client_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com'; $client_secret= 'XXXXXXXXXXXXXXXXXXXXXXXX'; $redirect_uri = 'http://localhost/oauth2callback.php'; // Create a new Google client object $client = new Google_Client(); $client->setClientId($client_id); $client->setClientSecret($client_secret); $client->setRedirectUri($redirect_uri); // Request authorization $client->addScope("https://www.googleapis.com/auth/contacts.readonly"); $auth_url = $client->createAuthUrl(); // Redirect to authorization page header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
// Set up Yahoo authorization credentials $consumer_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $consumer_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $access_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // Create a Yahoo client object $yahoo = new YahooAPIMail($consumer_key, $consumer_secret); // Request contacts $yahoo->setOAuthTokens($access_token, $access_secret); $yahoo_contacts = $yahoo->getContacts();In this example, we set up Yahoo authorization credentials and create a Yahoo client object. We then request the user's contact list and store it in the $yahoo_contacts variable.