Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filemtime() with remote files

Status
Not open for further replies.

pmlkheldar

Programmer
Feb 3, 2006
4
US
I'm going crazy here, this should be so EASY.

I need to get the last modified time of a remote file. Simple right?

echo filemtime("
Unfortunately this does not work... documentation at php.net says it will work in 5.0 or higher PHP, so I upgraded to 5.04... no change. It simply will NOT work with remote files. Local files are totally fine, but not remote.

Anyone know how to achevie this? I've been beating my head against this for nearly a week now and have gotten nowhere.
 
According to the PHP online manual entry for filemtime() ( the function can be used with some URL wrappers. The entry says that the URL wrapper must support the stat() family of functionality and further refers one to Appendix M.

Appendix M, particularly the entry for HTTP and HTTPS ( says in Table M-2 that the the HTTP and HTTPS wrappers do not support stat().

You can't do what you want to do. I would have been suprised if this would have worked through HTTP, as I didn't think web servers exposed that data.

Perhaps if the web server allows directory listings, you could get the data there.





Want the best answers? Ask the best questions! TANSTAAFL!
 
Hmmm that's odd, here is the table in the appendix I read:

Restricted by allow_url_fopen. No
Allows Reading Yes
Allows Writing Yes
Allows Appending Yes
Allows Simultaneous Reading and Writing Yes
Supports stat() Yes
Supports unlink() Yes
Supports rename() Yes
Supports mkdir() Yes
Supports rmdir() Yes

That appendix is located at as opposed to wrappers.http.php as you posted. I wonder what accounts for the difference?

Anyway, it clearly states that http is supported for stat(). So... now I'm even more confused.
 
Actually in reading the table again, I'm not sure if http is what it's referring to, or not. Very confounding...
 
Ah I see now... sorry for the confusion, the links at the top are actually to entirely DIFFERENT tables, where I thought they were just to anchors further down the page.

OK so the answer is, stat() is not supported. Boy what a drag.
 
do you have control over the remote server? if so, what you want should be achievable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top