The fastest way to get users' email contact from Google Gmail and Microsoft Outlook.
2. Get id, secret and set redirect uri in above consoles, set them in google_config.json and microsoft_config.json.
{
"client_id": "xxxxx",
"redirect_uri": "http://xxxxxx",
"client_secret": "xxxxx"
}Let's take Gmail for example:
// This is the controller method which redirect user to Goole authentication page.
function auth_google(){
$ec = new EasyContact();
redirect($ec->google->getAuthUrl());
}
// This is the controller method Goole will redirect user back.
function receive_google(){
$ec = new EasyContact();
$contacts = $ec>google->getContacts();
foreach($contacts as $contact){
echo $contact['name'] . ":";
echo $contact['address'];
echo '<hr />';
}
} Change $this->google to $this->microsoft, Then you can get contact from them! That's all!