├── .htaccess ├── README.md ├── download.php └── index.php /.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteBase / 3 | RewriteRule ^dl/(.+)$ download.php?gd=$1 4 | 5 | ErrorDocument 400 / 6 | ErrorDocument 401 / 7 | ErrorDocument 402 / 8 | ErrorDocument 403 / 9 | ErrorDocument 404 / 10 | ErrorDocument 405 / 11 | ErrorDocument 406 / 12 | ErrorDocument 407 / 13 | ErrorDocument 408 / 14 | ErrorDocument 409 / 15 | ErrorDocument 410 / 16 | ErrorDocument 411 / 17 | ErrorDocument 412 / 18 | ErrorDocument 413 / 19 | ErrorDocument 414 / 20 | ErrorDocument 415 / 21 | ErrorDocument 416 / 22 | ErrorDocument 417 / 23 | ErrorDocument 422 / 24 | ErrorDocument 423 / 25 | ErrorDocument 424 / 26 | ErrorDocument 500 / 27 | ErrorDocument 501 / 28 | ErrorDocument 502 / 29 | ErrorDocument 503 / 30 | ErrorDocument 504 / 31 | ErrorDocument 505 / 32 | ErrorDocument 506 / 33 | ErrorDocument 507 / 34 | ErrorDocument 510 / 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google Drive Direct Download 2 | *This is a PHP script for creating direct download file from Google Drive without visiting google drive page.* 3 | 4 | # How to use: 5 | *Simple, you only copy ID of google drive link and replace to your site project* 6 | 7 | Example: 8 | - GD Link : https://drive.google.com/file/d/1Xr757YxqoabeaW6Ra4eRu-iUaxOB32rU/view 9 | - Replacing : https://yourdomain.com/dl/1Xr757YxqoabeaW6Ra4eRu-iUaxOB32rU 10 | 11 | #NOTE : Just copy ID google drive link and replace to your url and don't forget to adding folder url **/dl/** before ID (https://yourdomain.com/dl/ID-GOOGLE-DRIVE) 12 | 13 | # Testing my project 14 | *https://gddl.herokuapp.com/dl/1Xr757YxqoabeaW6Ra4eRu-iUaxOB32rU* 15 | 16 | (c) 2019 st4zz 17 | -------------------------------------------------------------------------------- /download.php: -------------------------------------------------------------------------------- 1 | 'POST', 14 | CURLOPT_SSL_VERIFYPEER => false, 15 | CURLOPT_POSTFIELDS => [], 16 | CURLOPT_RETURNTRANSFER => true, 17 | CURLOPT_ENCODING => 'gzip,deflate', 18 | CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, 19 | CURLOPT_HTTPHEADER => [ 20 | 'accept-encoding: gzip, deflate, br', 21 | 'content-length: 0', 22 | 'content-type: application/x-www-form-urlencoded;charset=UTF-8', 23 | 'origin: https://drive.google.com', 24 | 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36', 25 | 'x-client-data: CKG1yQEIkbbJAQiitskBCMS2yQEIqZ3KAQioo8oBGLeYygE=', 26 | 'x-drive-first-party: DriveWebUi', 27 | 'x-json-requested: true' 28 | ] 29 | )); 30 | $response = curl_exec($ch); 31 | $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 32 | curl_close($ch); 33 | if($response_code == '200') { // Jika response status OK 34 | $object = json_decode(str_replace(')]}\'', '', $response)); 35 | if(isset($object->downloadUrl)) { 36 | return $object->downloadUrl; 37 | } 38 | } else { 39 | return $response_code; 40 | } 41 | } 42 | $docsurl = udud($id); 43 | header("location: $docsurl"); 44 | ?> 45 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 9 | --------------------------------------------------------------------------------