For files that already exist you can set the content as below:
[admin@MikroTik] > /file pri where name="test.txt"
# NAME TYPE SIZE CREATION-TIME
57 test.txt .txt file 0 jun/17/2010 14:05:42
[admin@MikroTik] > :local test "test"; /file set [/file find name="test.txt"] contents=$test;
[admin@MikroTik] > /file pri where name="test.txt"
# NAME TYPE SIZE CREATION-TIME
57 test.txt .txt file 4 jun/17/2010 14:06:38
[admin@MikroTik] >
Variables can’t be larger than 4096 bytes so that is the maximum amount of information you can write to a file.
But you should also look into the API, or SNMP. There’s a PHP library and you could just get this information directly without having to write to a file and fetch it via FTP.