Developer Snippet Diary

download wordpress using php code file_get_contents, file_put_contents

1. create a new file where you want to download the file and paste below code ie download.php

$download_file = "https://wordpress.org/latest.zip";
$downloaded_file = file_get_contents($download_file);
file_put_contents('downloaded_.zip', $downloaded_file);
echo "File downloaded successfully";

 

2. open the url ie yourdomain.com/download.php

3. it will download content in downloaded_.zip file on your website

Posted by: R GONDAL
Email: rizikmw@gmail.com