xxxxxxxxxx
<?php
$folderId = 'YOUR FOLDER ID'; // Replace with the ID of your Google Drive folder
$url = "https://drive.google.com/drive/folders/{$folderId}";
// Fetch the HTML content of the Google Drive folder link
$html = file_get_contents($url);
// Extract the file IDs and names from the HTML
preg_match_all('/data-id="(.*?)".*?data-tooltip="(.*?)"/', $html, $matches);
// Prepare the file list as an array
$fileList = array();
for ($i = 0; $i < count($matches[0]); $i++) {
$fileList[] = array(
'id' => $matches[1][$i],
'name' => $matches[2][$i]
);
}
// Return the file list as JSON
header('Content-Type: application/json');
echo json_encode($fileList, JSON_PRETTY_PRINT);
?>