• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » PHP Script to Download, Upload and Uncompress on FTP

By Abhishek Ghosh September 14, 2012 5:33 pm Updated on September 14, 2012

PHP Script to Download, Upload and Uncompress on FTP

Advertisement

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.

Advertisement

---

 

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 :

 

Vim
1
<span style="color: #993300;">&lt;?php</span>

Vim
1
<span style="color: #99cc00;">$url</span> <span style="color: #993300;">=</span> <span style="color: #ff00ff;">"http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.2.tar.gz"</span><span style="color: #993300;">; </span>

 

Vim
1
<span><span style="color: #0000ff;">// Use the latest url within " marks, you can delete these blue lines</span> </span>

Vim
1
<span style="color: #99cc00;">$file</span> <span style="color: #993300;">=</span>

Vim
1
<span style="color: #993300;"><span style="color: #ff00ff;">"mediawiki-1.19.2.tar.gz"</span>; </span><span style="color: #0000ff;">// We are using a short name in above line</span>

Vim
1
<span style="color: #99cc00;">$esc</span> <span style="color: #993300;">=</span>

Vim
1
2
3
4
escapeshellarg(<span style="color: #99cc00;">$url</span>)<span style="color: #993300;">;</span>
exec("wget " . <span style="color: #99cc00;">$esc</span>);
<span style="color: #99cc00;">$shell</span> <span style="color: #993300;">=</span> <span style="color: #ff00ff;">"tar -xzvf <span style="color: #99cc00;">$file</span>"<span style="color: #800000;">;</span> </span>
<span style="color: #0000ff;">//as the file is tar.gz we will use </span><span style="color: #0000ff;">$shell = "unzip $file";  </span>

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

Vim
1
<span style="color: #99cc00;"><span style="color: #0000ff;">// We need to delete it</span> $del</span><span style="color: #993300;"> =</span> escapeshellcmd(<span style="color: #99cc00;">$del</span>)<span style="color: #993300;">;</span>

Vim
1
exec(<span style="color: #99cc00;">$del</span>,<span style="color: #99cc00;">$nu</span>)<span style="color: #993300;">; <span style="color: #0000ff;">// This will show the word Complete at the end of operation</span> </span>

Vim
1
print_r(<span style="color: #ff00ff;">"Complete!"</span>)<span style="color: #993300;">;</span>

Vim
1
<span style="color: #993300;">?&gt;</span>

 

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 ?

 

SignatureTagged With php script download , phpprogramthat performfile up loading and dowload , script download php , script ftp php , script shareasale ftp php , uncompress and upload to ftp
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to PHP Script to Download, Upload and Uncompress on FTP

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Unix Shell or Shell

    Unix Shell or Shell refers to the traditional user interface under Unix or Unix-like computer operating systems. User can type a command type, which is executed by the computer.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Implementation of Requirements in Electronic Archiving SystemsDecember 2, 2023
  • What is Database ArchivingDecember 1, 2023
  • Problems of Search EngineDecember 1, 2023
  • How Search Engine WorksNovember 30, 2023
  • Data Mining: An OverviewNovember 30, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy