";
print_r($headers);
echo "";
curl_setopt($ch, CURLOPT_URL, $headers['Location']);
//curl_setopt($ch, CURLOPT_URL, "https://drive.google.com/file/d/0Bz7LPEoNglspOE1fWWdFd2MwN3M/edit");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
$result = curl_exec($ch);
echo "
";
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
echo "
";
echo "File from GoogleDrive Is :-
";
if ( isset($headers['Content-Length']) ) {
$size = 'file size:' . $headers['Content-Length'];
$fileName = "";
preg_match_all("/\\w+\\.\\w+/", $headers['Content-Disposition'], $output);
$fileName = $output[0][0];
$fileLocation = $headers['Location'];
file_put_contents($fileName,$result);
}
else {
$size = 'file size: unknown';
$fileName = "";
preg_match_all("/\\w+\\.\\w+/", $headers['Content-Disposition'], $output);
$fileName = $output[0][0];
$fileLocation = $headers['Location'];
file_put_contents($fileName,$result);
}
echo $size;
echo "";
print_r($result);
echo "
";
}
?>