I am having signin with Google+ to retrieve the users basic profile info(Name, Urls, Location, Profile Picture). But I want to also retrieve the user-id of the users friend so that i can give him/her better suggestion of whom the user already know in my website.
$app_access_token = GetCH();
function GetCH(){
$ch = curl_init();
$pieces = explode(",", $_SESSION['access_token']); $piece = explode(":", $pieces[0]);
$token = str_replace('"',"",$piece[1]);
$url = "https://www.googleapis.com/oauth2/v1/userinfo?access_token=".$token;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETU`enter code here`RNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
if(substr($url,0,8)=='https://'){
curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
}
$sendCH = curl_exec($ch);
curl_close($ch);
return $sendCH;
};
if ($client->getAccessToken()){
$me = $plus->people->get('me');
$user_id = filter_var($me['id'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$url = filter_var($me['url'], FILTER_VALIDATE_URL);
$img = filter_var($me['image']['url'], FILTER_VALIDATE_URL);
$name = filter_var($me['displayName'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
// The access token may have been updated lazily.
$_SESSION['access_token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
}
For More Information: https://developers.google.com/apis-explorer/#p/plus/v1/ But I am unable to figure how to get the friend list as an array from their API
Thanks in Advance