shergar1983 Posted February 4, 2008 Share Posted February 4, 2008 Hopefully this post doesn't seem stupid to anyone... I have a need to create a php script that will scan a static page on another website to retrieve the date it was created / last updated. There is not web service on the remote site and I have no control over it. Is this at all possible, or a complete 'no no'? I'd really appreciate any help, this one has had me head-scratching for days. Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/ Share on other sites More sharing options...
cooldude832 Posted February 4, 2008 Share Posted February 4, 2008 what is going to tell you its creation date? You can't get the file's data usually so it will need to be in its source code Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-457802 Share on other sites More sharing options...
shergar1983 Posted February 4, 2008 Author Share Posted February 4, 2008 Unfortunatley there's no stamp in the source so I can't do that - although in honesty I would proably be stuck there as well. Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-457807 Share on other sites More sharing options...
PFMaBiSmAd Posted February 4, 2008 Share Posted February 4, 2008 For the last modification date of a file that can be requested via a URL, see the get_headers() function - http://php.net/get_headers Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-457808 Share on other sites More sharing options...
shergar1983 Posted February 4, 2008 Author Share Posted February 4, 2008 Wow that looks promising, got to leave for home now, I'll try it when I get there and let you know how I get on. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-457810 Share on other sites More sharing options...
sKunKbad Posted February 4, 2008 Share Posted February 4, 2008 The get_headers function is not going to show a header that wasn't generated by the script/server. It can't magically check for a last modified date. Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-457824 Share on other sites More sharing options...
shergar1983 Posted February 5, 2008 Author Share Posted February 5, 2008 I can happily confirm that the get_headers function does indeed do the trick, for most servers anyway. IIS6 seems to be the exception, however most websites I tested to send the last modified date in the headers. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/89402-solved-get-a-remote-webpages-creation-date/#findComment-458537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.