Home arrow PHP arrow Page 4 - Watching The Web

Backtracking - PHP

Ever wondered if you could be emailed automatically whenever yourfavorite Web pages changed? Our intrepid developer didn't just wonder -he sat down and wrote some code to make it happen. Here's his story.

TABLE OF CONTENTS:
  1. Watching The Web
  2. Code Poet
  3. Digging Deep
  4. Backtracking
  5. Plan B
  6. Closing Time
By: The Disenchanted Developer, (c) Melonfire
Rating: starstarstarstarstar / 7
October 23, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
So far, it looks like everything's hunky-dory - but being the suspicious character I am, I thought it might be worth trying the code out against a few servers before accepting the script above as a reliable tool. And that's when I hit my first roadblock - as it turned out, some servers didn't return the "Last-Modified" header, which meant that the script couldn't determine when the page had been last modified.

I thought this was pretty strange, as it seemed to be a violation of the rules laid down in the HTTP protocol. Back to the specification, then, to see if I could resolve this apparent conflict...

A little close reading, and the reason for the discrepancy became clear: HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.In other words - they don't *have to*. And there's many a slip betwixt the cup and the lip...

OK, maybe I should have read the fine print before writing that script. Still, better late than never.

Back to the drawing board, then. After a little thought and a few carefully-posed questions to the PHP mailing lists, it seemed that my initial plan was still the most reliable - download and store the contents of each URL, and compare those contents against the previous version to see if there was any change. This wasn't the most efficient way to do it - but it didn't look like I had any alternatives.

 
 
>>> More PHP Articles          >>> More By The Disenchanted Developer, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: