rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: pedrocarvalho on August 25, 2015, 02:21:13 PM

Title: mtime
Post by: pedrocarvalho on August 25, 2015, 02:21:13 PM
Hi!

thank you for your work with HFS!  i've set it up with password protection.

i can GET the files just fine, but i need to test the modification time of the file but i get an error whenever i try to call filemtime() from our own servers.

Code: [Select]
PHP Warning:  filemtime(): stat failed for ...
i'm calling it like this:
Code: [Select]
$srv_file = "http://$user:$password@[domain.com/file]";
//$srv_hash = md5_file($srv_file); // works
$srv_mtime = filemtime($srv_file); //doesn't work



any reason to fail? I've read through the menus, the FAQ and wiki, but i couldn't find any option related to this. Thank you for any help!
Title: Re: mtime
Post by: bmartino1 on August 25, 2015, 06:26:15 PM
unless you have modified the template to execute cgi php(http://php.net/manual/en/install.unix.commandline.php) download: http://windows.php.net/qa/ , hfs doesn't nattily support php commands, which is why you are receiving the php error.

HFS is scripted in its own code with html code please see the wiki on HFS available scripting stuff:
http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands

you will probably want the area via get:
time | A
returns current time information. The format is specified by optional parameter A. Refer to this page for format syntax. If A is not supplied, value "c" will be used.
Optional parameter when to specify a time other than current.
Optional parameter offset to specify the number of days differing from the current time.
Title: Re: mtime
Post by: rejetto on August 26, 2015, 10:49:46 AM
getting mtime of a remote file is very different than a local file.
For a start, i can see from the PHP documentation that it is supported only since version 5.
If you cannot make it work, in the comments you can find functions to do the job the hard way
http://php.net/manual/en/function.filemtime.php#73747