Skip to content

Instantly share code, notes, and snippets.

@sorich87
Created May 30, 2011 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorich87/999145 to your computer and use it in GitHub Desktop.
Save sorich87/999145 to your computer and use it in GitHub Desktop.
<?php
function file_it($url) {
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
$contents = curl_exec($c);
curl_close($c);
$file = basename($url);
if ($contents) file_put_contents($file, $contents);
echo "$file ok<br />";
}
file_it('http://wordpress.org/latest.tar.gz');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment