Good afternoon, I have the following demand. I have a spreadsheet in Google Drive and I need to read two data (CNPJ and one image), and download this image with the Cnpj name.
I used the following code:
<?php
$url_do_arquivo = "https://docs.google.com/spreadsheets/d/e/2PACX-1vQ-
YbHlxv-EYBCWYi8EfQiJsCLHJ2vuJOo1lw6t4hN7gEFXI-0JigSGHl4aZCyPb-
ON6AduR_lbpIvg/pub?output=csv";
if (($identificador = fopen($url_do_arquivo, 'r')) !== FALSE) {
echo '<pre>';
while (($linha_do_arquivo = fgetcsv($identificador, 0, ",")) !== FALSE) {
printf("%-10s %-19s <br />", $linha_do_arquivo[1],
$linha_do_arquivo[3]);
file_put_contents($linha_do_arquivo[1],file_get_contents(
$linha_do_arquivo[3]));
}
echo '</pre>';
// Libera o recurso aberto
fclose($identificador);
} else {
echo 'Não foi possível abrir o arquivo';
}
I got the following result:
Thiswassatisfactorytome,butwhentryingtodownload,Icameacrossthefollowingproblem,theURLIcaptureddoesnotleadtotheimagelink,butrathertothefollowingpage:
I come to you with the following question, how do I get this permission and download the image?
Thank you in advance.