View

wget, unzip and delete a File per Shell via PHP

  1. <?php
  2.     $url = “http://www.url.net/file.zip”;
  3.     $file = “file.zip”;
  4.     $esc = escapeshellarg($url);
  5.     exec(“wget “ . $esc);
  6. //use ur extension and remove the //comandlines
  7.     //$shell = “tar -xzvf $file”; //tar
  8.     //$shell = “unzip $file”; //zip
  9.     $shell = escapeshellcmd($shell);
  10.     exec($shell,$nu);
  11. //del file
  12.     $del = “rm $file”;
  13.     $del = escapeshellcmd($del);
  14.     exec($del,$nu);
  15.     print_r(“done”);
  16. ?>

You may also like