Skip to content

Instantly share code, notes, and snippets.

@py7hon
Last active October 22, 2020 17:42
Show Gist options
  • Save py7hon/ef2618fa5fe8783268bca5d1c75552cc to your computer and use it in GitHub Desktop.
Save py7hon/ef2618fa5fe8783268bca5d1c75552cc to your computer and use it in GitHub Desktop.
<?php
if ($_GET['id'] == ""){
http_response_code(404);
die("ID Not Found");
} else {
$drive_id = $_GET['id'];
$apikey = "AIzaSyBPO_VhHtvTL-gs35Nb24cSsjuxQasjlN0";
$data = json_decode(file_get_contents("https://www.googleapis.com/drive/v2/files/$drive_id?supportsTeamDrives=true&key=$apikey"), true);
$mime = $data["mimeType"];
$link = file_get_contents("https://www.googleapis.com/drive/v3/files/$drive_id?key=$apikey&supportsTeamDrives=true&alt=media");
header('Content-type: $mime');
http_response_code(200);
echo $link;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment