Ejemplo n.º 1
0
if (isset($_SESSION['token']))
{
	try{
		$client -> setAccessToken($_SESSION['token']);
		$match = true;
	}catch(Exception $ex){
		$match = false;
	}
	
}

if (isset($_REQUEST['logout']))
{
	unset($_SESSION['token']);
	$client -> revokeToken();
}

if (isset($_REQUEST['error']) && $_REQUEST['error'] == 'access_denied')
{
	processDeniedAndExit('gmail');
	exit();
}

if ($match && $client -> getAccessToken())
{
	$req = new apiHttpRequest("https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=1000");
	$val = $client -> getIo() -> authenticatedRequest($req);

	// The contacts api only returns XML responses.
	$data = json_decode($val -> getResponseBody(), true);