Skip to content

Instantly share code, notes, and snippets.

@andreiglingeanu
Last active August 5, 2022 16:05
Show Gist options
  • Save andreiglingeanu/6cc73f97ef4789a6e84990b20b0b71c9 to your computer and use it in GitHub Desktop.
Save andreiglingeanu/6cc73f97ef4789a6e84990b20b0b71c9 to your computer and use it in GitHub Desktop.
<?php
function download_file($url, $destination) {
echo 'downloading ' . $destination . "\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_ENCODING, "UTF-8" );
$data = curl_exec ($ch);
$error = curl_error($ch);
if (substr($destination, -7) === 'lnr.css') {
}
curl_close ($ch);
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment