How to find out when a web page was last changed?
Is there a way to find out when a web pag开发者_运维百科e was last changed using PHP? (The web page is hosted on a different website).
You could use that lame method :
$checksum = md5(file_get_contents("http://www.site.com"));
You can store that value and compare it later.
Good luck
Last-Modified header in http. But there is no guarantee it will function correctly. Last modified header can be set incorrectly, or not set at all.
Sure, just use curl and pull the header out.
I would check out this similar question / answer:
Header only retrieval in php via curl
Using cUrl , you can check the headers but if they are not set corectly then you're lost . The only thing i can think of is testing if the content has chaged , you can get the contet of the homepage with cUrl or file_get_contents() ( if it's allowed on you're host ) , hash it and save it in a database , then when you whant to check again you can make a cUrl request , hash the result and check with the one you got in you're database .
精彩评论