I seem to be running into a documentation drought with CURL vs FTP, can anyone tell me how to get the last modified date of a given file using PHP / CURL.
Many thanks!
Try this, it seems to work ok here but I have only tested it on one server:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,"ftp://server/file");
curl_setopt($curl, CURLOPT_USERPWD, "user:pass");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_NOBODY, 1);
curl_setopt($curl, CURLOPT_FILETIME, TRUE );
$result = curl_exec ($curl);
$time = curl_getinfo($curl, CURLINFO_FILETIME);
print date('d/m/y H:i:s', $time);
curl_close ($curl);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With