मैं अपने दोस्तों के ईमेल के साथ पूर्ण संपर्क सूचियां प्राप्त करना चाहता हूं। मैं संपर्कों की सूची प्राप्त कर सकता हूं लेकिन ईमेल नहीं प्राप्त कर सकता हूं। मैं कैसे संपर्क सूची से ईमेल प्राप्त कर सकते हैंGoogle API - संपर्क मेल प्राप्त करें
require_once APPPATH . 'vendor/google/src/Google_Client.php';
require_once APPPATH . 'vendor/google/src/contrib/Google_Oauth2Service.php';
$client = new Google_Client();
$client->setApplicationName("PHP Google Test");
$client->setClientId('xxx');
$client->setClientSecret('xxx');
$client->setRedirectUri('http://www.domain.xx/admin/others/google?test');
$client->setScopes("http://www.google.com/m8/feeds/");
$oauth2 = new Google_Oauth2Service($client);
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
$redirect = 'http://www.domain.xx/admin/others/google';
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if (isset($_REQUEST['logout'])) {
unset($_SESSION['token']);
$client->revokeToken();
}
if ($client->getAccessToken()) {
$req = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/default/full");
$val = $client->getIo()->authenticatedRequest($req);
$response = json_encode(simplexml_load_string($val->getResponseBody()));
print "<pre>" . print_r(json_decode($response, true), true) . "</pre>";
$_SESSION['token'] = $client->getAccessToken();
} else {
$auth = $client->createAuthUrl();
}
$auth = $client->createAuthUrl();
echo '<a href="' . $auth . '" target="_blank">' . $auth . '</a>';
:
यहाँ मेरी कोड है?
कोड::
$response = json_encode(simplexml_load_string($val->getResponseBody()));
print "<pre>" . print_r(json_decode($response, true), true) . "</pre>";
को बदलें:
किसी ने मुझसे मदद का पता लगाएं? –
उत्तर के साथ बिल्कुल वही प्रश्न है: http://stackoverflow.com/questions/21469433/how-to-get-email-address-when-user-is-authenticated-with-google-oauth2-and-peopl – Jehy
नहीं, मुझे संपर्कों से ईमेल प्राप्त करने की आवश्यकता है :) –