I want to download the wordpress from its website (wordpress.org) to my ftp host directly. I heard that there is a way to do it directly instead of download it and then upload again.
How can I do it? using ftp or php.
edit:
I do not have ssh access to the server. it is a free server at: FreeWebHostingArea.com
edit2:
Some websites offered a way to send fie to the target server by php. but I need a way to download (not send) file to my ftp server.
After a little search I found how to download it. Here is the code:
<?php
$new_file = file_get_contents('http://wordpress.org/latest.zip') or exit('unable to open from wordpress');
$current = fopen('latest.zip','c') or exit("Unable to open file!");
fclose($current);
chmod('latest.zip',0777);
file_put_contents('latest.zip',$new_file);
echo 'Done';
?>
This script first opens the "latest.zip" from wordpress.org
Then opens a fie named "latest.zip" in the host. and close it. It should set the chmod
in order to write to file.
At last it puts the contents of downloaded file to "latest.zip" to the host.
Important: The folder which you upload this "script.php" should have write access in order to create the "latest.zip" file.