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).
4 Answers
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

- 3,248
- 5
- 42
- 61
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.

- 1,730
- 4
- 19
- 30
Sure, just use curl and pull the header out.
I would check out this similar question / answer:
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 .

- 9,577
- 2
- 39
- 43
-
@Cybrix: maybe if you didn't posted it nobody would have noticed mine since i didn't entered any code ( usualy works that way around here ) , it should be all good if the right answer was aproved ( doesn't matter if it's mine or you'res , we both try to help ) . – Poelinca Dorin Jan 08 '11 at 02:45