PHP Script to Download, Upload and Uncompress on FTP


PHP Script to Download, Upload and Uncompress on FTP is easy with a PHP script. It can download from source, uncompress any thing including WordPresslike CMS. Please take the fact that this is actually not a script providing article, the target of this guide to write a PHP Script to Download, Upload and Uncompress on FTP is to make anyone understand, PHP is not very difficult, many modification can be done as per your need.

 

Basics you will need to code PHP Script to Download, Upload and Uncompress on FTP

 

For this guide it is quite obvious that you need a Server with FTP or SFTP access. Shell access is not need. You can use any advanced Text Editor like Gedit. Windows users can also can use Gedit. This is due to the fact they support Syntax Highlighting feature.

 

Basics for PHP Script to Download, Upload and Uncompress on FTP

 

The major problem is, many Open Source Project do not have the rightly configured url for download link. For example, WordPress always makes it latest.tar.gz for any version. So practically to get the URL, you have to browse to the official Website and get the URL manually. For WordPress you can download such a ready made php script to Download, Upload and Uncompress on FTP from our guide Automate Uploading and Uzipping WordPress on Rackspace Cloud Sites. This will obviously give you the way how to use it.

 

If you open Gedit and create a new blank file with the name upload.php then, depending on your configuration / settings, PHP Script will automatically get Syntax Highlighting.

 

Basic targets to write the PHP Script to Download, Upload and Uncompress on FTP :

 

  1. Download it from official URL as compress folder and upload to SFTP. This is actually done by wget in case of Shell.
  2. Umcompress it. Equivalent to tar -xzvf function in shell.
  3. Delete the original file,  Equivalent to rm with name of the file.

 

This is how we can do which is simplified from posteet.com/view/1079 :

 

<?php
$url = "http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.2.tar.gz"; 

 

// Use the latest url within " marks, you can delete these blue lines 
$file =
"mediawiki-1.19.2.tar.gz"; // We are using a short name in above line
$esc =
escapeshellarg($url);
exec("wget " . $esc);
$shell = "tar -xzvf $file"; 
//as the file is tar.gz we will use $shell = "unzip $file";  

$shell = escapeshellcmd($shell);
exec($shell,$nu);
$del = “rm $file;


// We need to delete it $del = escapeshellcmd($del);
exec($del,$nu); // This will show the word Complete at the end of operation 
print_r("Complete!");
?>

 

Like This is your gedit :

 

PHP Script to Download, Upload and Uncompress on FTP

 

This PHP Script to Download, Upload and Uncompress on FTP does the work, but its painful to use. We can reduce the pain by using a form action like this to get a HTML. If you can do it, you will see it is very easy, but some people sells them in Code Canyon like website as premium scripts ! PHP itself is free, for this small lines, is it really honors Open Source ?

 

Signature


0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave Lame Behind - Get Engaged

Here’s what we’ve got for you:

Contact Us Today for Smarter Marketing of Knowledge

See each of the premium resources below:

For Publishers and Content Owners

Do you want to optimize your available content?

Do you want to increase the visibility of your content?

Do you want to increase your reliability as an Author?

Do you want your next or existing project to be technically planned?

If your answer to any of these is YES contact us with your approximate budget.

Contact Us Today

For the Media Companies and Advertisers

You must be seeking a publisher website like ours with real content to give an exposure to your client's business?

We provide Industry's Standard opportunities for advertisement.

All comes with proper invoicing, SLA on per annum basis.

If your answer is YES contact us today for a quote.

Contact Us Today for Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>