Created
July 5, 2018 13:04
-
-
Save muthu32/5efa634c31d724da8f71640276a1d1fd to your computer and use it in GitHub Desktop.
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
| //Download remote file | |
| function getUrlFile($url, $path) | |
| { | |
| $newfilename = $path; | |
| $file = fopen($url, "rb"); | |
| if ($file) { | |
| $newfile = fopen($newfilename, "wb"); | |
| if ($newfile) | |
| while (!feof($file)) { | |
| fwrite($newfile, fread($file, 1024 * 8), 1024 * 8); | |
| } | |
| } | |
| if ($file) { | |
| fclose($file); | |
| } | |
| if ($newfile) { | |
| fclose($newfile); | |
| } | |
| } | |
| $path = '/var/www/vhosts/test.com/httpdocs/shop/mpdf.zip'; | |
| $url = 'https://php-download.com/downloads/mpdf/mpdf/7.1.1.0/mpdf_mpdf_7.1.1.0_require.zip'; | |
| getUrlFile($url, $path); | |
| //system('unzip myzip.zip'); | |
| $zip = new ZipArchive; | |
| $res = $zip->open('mpdf2/mpdf.zip'); | |
| if ($res === TRUE) { | |
| $zip->extractTo('/var/www/vhosts/test.com/httpdocs/shop/'); | |
| $zip->close(); | |
| echo 'woot!'; | |
| } else { | |
| echo 'doh!'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment