Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. include('../users/init.php');
  3. $url = "https://userspice.com/patch/43to44.zip";
  4. $zipFile = "update.zip"; // Local Zip File Path
  5. $zipResource = fopen($zipFile, "w");
  6. // Get The Zip File From Server
  7. $ch = curl_init();
  8. curl_setopt($ch, CURLOPT_URL, $url);
  9. curl_setopt($ch, CURLOPT_FAILONERROR, true);
  10. curl_setopt($ch, CURLOPT_HEADER, 0);
  11. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  12. curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  13. curl_setopt($ch, CURLOPT_BINARYTRANSFER,true);
  14. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  15. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  16. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  17. curl_setopt($ch, CURLOPT_FILE, $zipResource);
  18. $page = curl_exec($ch);
  19. if(!$page) {
  20. echo "Error :- ".curl_error($ch);
  21. }
  22. curl_close($ch);
  23. $zip = new ZipArchive;
  24. if($zip->open($zipFile) != "true"){
  25. echo "Error :- Unable to open the Zip File";
  26. }
  27. /* Extract Zip File */
  28. $zip->extractTo($abs_us_root.$us_url_root);
  29. $zip->close();
  30. unlink($zipFile);
  31. Redirect::to('../test.jpg');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement