Last active
December 10, 2015 17:28
-
-
Save santosh/4467450 to your computer and use it in GitHub Desktop.
PHP: A PHP script to download files directly download files to webserver. This can help prevent your bandwidth of both end user and the webserver in situations like downloading WordPress to your computer then uploading to server. [Its just the case, WordPress like scripts are already included in some hosting plans ;)].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Please make sure that you already create a file that you are setting in $saveas variable, | |
and set its permission to 777 else you can receive an error telling you like permission | |
denied etc. | |
*/ | |
// file to open and save to | |
$saveas = "capitalizr.py.zip"; | |
// file to be downloaded | |
$fileToDownload = file_get_contents("https://github.com/santosh/capitalizr.py/archive/master.zip"); | |
// the main stuff | |
file_put_contents($saveas, $downloadThis); | |
// yes, I have missed the ending PHP bracket and its not a fault, see the link below: | |
// http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.general |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment