Reputation: 267287
Is there a way to find out when a web page was last changed using PHP? (The web page is hosted on a different website).
Upvotes: 1
Views: 1383
Reputation: 3318
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
Upvotes: 3
Reputation: 9715
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 .
Upvotes: 1
Reputation: 1740
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.
Upvotes: 2
Reputation: 18863
Sure, just use curl and pull the header out.
I would check out this similar question / answer:
Header only retrieval in php via curl
Upvotes: 1