Skip to content

Instantly share code, notes, and snippets.

@prashantdsala
Created April 12, 2023 06:42
Show Gist options
  • Save prashantdsala/493f19012455f5689b99811e2b2a1e7c to your computer and use it in GitHub Desktop.
Save prashantdsala/493f19012455f5689b99811e2b2a1e7c to your computer and use it in GitHub Desktop.
PHP - Download file using "wget"
<?php
function __callURLinBackground($url) {
exec("wget -bqc ".$url." -P /var/www/html/", $output, $result_code);
echo $output;
echo $result_code;
echo '<pre>';print_r($output);
echo '<pre>';print_r($result_code);
echo 'Running in background';
}
// call a URL in background
__callURLinBackground('https://sample-videos.com/csv/Sample-Spreadsheet-10-rows.csv');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment