I have a program to download files from server (using ftp_connect) using php and save the files in my local system.While saving the files in local system file's modified time changes according to my system time

But what i need is the files saved in local should have the same modified time it has in server.
(i.e)while saving the file the modified time shouldn't change.

Or is there any methods available to save a file with specified modified time?

You can read remote modify time and then use touch(): http://php.net/manual/en/function.touch.php
If you are in a linux box you can use exec() and terminal command touch:

exec('touch -m -d "2009-12-25 11:06:30" file.txt');

Otherwise download archives like zip, gz, tar, this should prevent changes in the modify time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.