Skip to content

Instantly share code, notes, and snippets.

@dividy
Created July 2, 2021 07:11
Show Gist options
  • Save dividy/f54f973cac95ebbd9f8e05e5a95e7b54 to your computer and use it in GitHub Desktop.
Save dividy/f54f973cac95ebbd9f8e05e5a95e7b54 to your computer and use it in GitHub Desktop.
<?php
$source_dir = "_source";
echo "<div>";
// create source directory
mkdir($source_dir);
// get latest french WordPress file
$ch = curl_init();
$source = "https://fr.wordpress.org/latest-fr_FR.zip";
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
// save as wordpress.zip
$saved_file = $source_dir."/wordpress.zip";
$file = fopen($saved_file, "w+");
fputs($file, $data);
fclose($file);
echo $saved_file." downloaded.";
$tmp = exec('unzip -o ' . $saved_file, $output, $ret);
$tmp = exec('mv wordpress/* .', $output, $ret);
echo "[ END ]";
echo "</div>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment