Compress and download from 3rd party ftp server using php

I'm downloading files from 3rd party ftp server using php. But file is more then 15mb. So it took more time to download. I have an idea to compress and download on the fly from ftp server. Is it possible to do so?

Thanks in advance.

Answers


You have to download the original file, one way or another. You can zip it with PHP, but only after you download the original file to your server. What you are asking is it the source server can compress it for you, which with FTP is not possible.

Consider using CURL to download the file from the FTP server. It's much more resiliant.

$curl = curl_init();
$file = fopen("file.zip", 'w'); ##where you want to save it
curl_setopt($curl, CURLOPT_URL, "ftp://ftp.sunet.se/file.zip"); #input
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FILE, $file); #output
curl_setopt($curl, CURLOPT_USERPWD, "$_FTP[username]:$_FTP[password]");
curl_exec($curl);
curl_close($curl);
fclose($file);

Source


Need Your Help

Opengl rotate an object using the mouse (C++)

c++ opengl rotation mouse glut

I have an object that I want to rotate using the mouse in Opengl (I'm using glut). I'm keeping track of the mouse movement and rotate according to the change in x and y of the mouse. But the proble...

Are these equally fast? (Map and List)

c++ list vector

Which one is faster? Fragment A or Fragment B? Or would they be more or less the same?

How to change current link color on my current page?

jquery css permalinks

I can't change my current link color. If I click one of my link, then it will go to the specified URL, but the color of the current link that opened is not change. Still showing the same color as the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.