How to Download Images with PHP

1

I have an urgent question.

I want to be able to download images using php, these image URLs are in a google docs spreadsheet, I was able to make the connection, and I was able to make a code to download, but the file that they see is different to me I expected:

URl of the image:

CodeI'musing:

<?php$url_do_arquivo="https://docs.google.com/spreadsheets/d/e/2PACX-1vQ-J4JhsR1TFU9iKPJFPOE77U2VqYECdGp9eiP1_XRbUaLEoZu8PjrdODrxxSSsl7mBQRks3T_Y9WTy/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>';

fclose($identificador);
} else {


echo 'Não foi possível abrir o arquivo';
}

How to solve this?

    
asked by anonymous 23.08.2018 / 13:37

0 answers