Skip to content

Instantly share code, notes, and snippets.

@PawelGIX
Last active December 28, 2023 16:40
Show Gist options
  • Save PawelGIX/e873a27d576f9ff67fee43120c8fa2a4 to your computer and use it in GitHub Desktop.
Save PawelGIX/e873a27d576f9ff67fee43120c8fa2a4 to your computer and use it in GitHub Desktop.
Download ProcessWire
<?php
$ch = curl_init();
$source = "https://github.com/processwire/processwire/archive/master.zip"; // THE FILE URL
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
$destination = "pw.zip"; // NEW FILE LOCATION
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
echo " pw.zip downloaded; ";
// unzip
$zip = new ZipArchive;
$res = $zip->open('pw.zip'); // zip
if ($res === TRUE) {
$zip->extractTo('.'); //
$zip->close();
echo ' pw.zip extracted; ';
unlink('pw.zip');
echo ' pw.zip deleted; ';
} else {
echo ' unzip failed; ';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment