Skip to content

Instantly share code, notes, and snippets.

@seangenabe
Created July 1, 2014 06:59
Show Gist options
  • Save seangenabe/86a8467468596fe8b706 to your computer and use it in GitHub Desktop.
Save seangenabe/86a8467468596fe8b706 to your computer and use it in GitHub Desktop.
Download files to a remote server.
<?php
if (isset($_POST['url'])) {
if (empty($_POST['filename'])) {
$filename = 'download.bin';
}
else {
$filename = $_POST['filename'];
}
# Credits: http://stackoverflow.com/a/3938551/1149962
file_put_contents($filename, $url);
exit('Done.');
}
?>
<form method="POST">
<label>
<span>URL: </span>
<input type="text" name="url">
</label>
<label>
<span>Filename: </span>
<input type="text" name="filename">
</label>
<input type="submit" value="Submit">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment