• 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 ?

 

Signature Tagged 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

This Article Has Been Shared 668 Times!

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

  • Syntax Highlighting : All About the Colorful Snippets

    Syntax Highlighting is a method for coloring certain words and characters in a text depending on their importance in in an piece of code or snippet.

  • Installing Piwik on Rackspace Cloud Sites

    Installing Piwik on Rackspace Cloud Sites is very easy and needs few steps. Piwik is an Open Source Server Installable Real Time Web Analytics Software.

  • Installing ownCloud on Rackspace Cloud Sites

    Installing ownCloud on Rackspace Cloud Sites step by step guide. ownCloud is a server software that provides device independent storage of pictures, documents.

  • Installing vBulletin Forum Software on Rackspace Cloud Sites

    Installing vBulletin Forum Software on Rackspace Cloud Sites needs extra works and the difficulty level is a bit higher than WordPress though not very tough.

  • Install Open Journal Systems on Rackspace Cloud Sites

    Install Open Journal Systems on Rackspace Cloud Sites just like any other PHP MySQL based application in easy to follow steps.

Additionally, 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 (22.1K 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

  • Why Data Management is so Important in a Business July 6, 2022
  • Application Modernization : Cloud Can Take Your Applications to the Next Level July 5, 2022
  • Ways To Make Sure Your Online Course Outshine Others July 3, 2022
  • Will Smart Factories Become the New Assembly Line? July 2, 2022
  • The Cost of Doing Business as a Handyman July 1, 2022

About This Article

Cite this article as: Abhishek Ghosh, "PHP Script to Download, Upload and Uncompress on FTP," in The Customize Windows, September 14, 2012, July 7, 2022, https://thecustomizewindows.com/2012/09/php-script-to-download-upload-and-uncompress-on-ftp-1/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

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

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