BrooklynPZ Posted September 10, 2008 Share Posted September 10, 2008 I am trying to determine the filemtime() and filetype() on a remote file. In the case where an initial webpage may display http://www.some-site.com I am not guaranteed the page is an *.html, since it may be *.htm, *.asp, *.jsp,... Is there a trick to getting the information that I need (file size, file type, last mod-date/time)? Thanks (in advance)! Link to comment https://forums.phpfreaks.com/topic/123546-reading-remote-file-attributes/ Share on other sites More sharing options...
corbin Posted September 10, 2008 Share Posted September 10, 2008 The server has to tell you. You'll have to delve into HTTP headers. (Google them) Link to comment https://forums.phpfreaks.com/topic/123546-reading-remote-file-attributes/#findComment-638056 Share on other sites More sharing options...
lisa71283 Posted September 10, 2008 Share Posted September 10, 2008 If you fetch the page with cURL, you can use curl_getinfo to retrieve the pertinent details of the document, as supplied by the webserver. cURL will eliminate a lot of the trouble of manually parsing an HTTP response retrieved through a socket. Link to comment https://forums.phpfreaks.com/topic/123546-reading-remote-file-attributes/#findComment-638059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.