$authheaders = array("Authorization: Bearer ACCESS_TOKEN");
$file = fopen('test.pdf', 'wb');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media');
curl_setopt($ch, CURLOPT_FAILONERROR, true);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_HTTPHEADER, $authheaders);
curl_exec($ch);
curl_close($ch);
fclose($file);