How to know if Access Token expires in Google Api PHP
问题 How will I know if my access token has expired. I'm using try and catch try { $result = file_get_contents('https://www.googleapis.com/calendar/v3/calendars/primary/events?access_token='.$accesstoken); print_r($result); } catch(Exception $e){ echo "Get new token"; } but still it gets error from the file_get_contents then prints "Get new token" If I want to use curl $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,'https://www.googleapis.com/calendar/v3/calendars/primary/events?access_token='.