check date modified
Hi guys,
I'm trying to find a way of checking the "date modified" of a particular page, and if it is equal to a certain value, then to redirect the browser to a different page. Basically, there's a page on someone's server that gets updated regularly. I would like to know as and when these updates have occured, so I want to create an asp page on my server that will keep checking the external webpage at regular intervals. When the "date modified" has changed, I need to know about it - so will redirect the open browser to a page that maybe has a sound file embedded to alert me. Any ideas? I've found a way to do it, but it can only retrieve the information if the target webpage is on the same server as the "checking script" page.
Cheers.
Jim.
Greg K posted this at 08:37 — 31st October 2004.
He has: 2,145 posts
Joined: Nov 2003
We use http://www.changenotes.com/ as one of the tools to monitor the competition. It will e-mail you when a site has any changes. The nice part, it's free!
-Greg
Renegade posted this at 10:09 — 31st October 2004.
He has: 3,022 posts
Joined: Oct 2002
You can try a "last updated" piece of code that I usually use:
$last_updated = $page_title . " was last updated: " . date ("F d Y", filemtime($page . ".php"));
'Found at my site
Mark Hensler posted this at 03:24 — 17th November 2004.
He has: 4,048 posts
Joined: Aug 2000
HTTP 1.0 (RFC 1945, section 10.10) and 1.1 (RFC 2616, section 14.29) have
an defined an optional "Last-Modified" header in the HTTP Response.
Syntax:
Last-Modified: Wed, 17 Nov 2004 03:08:16 GMT
If your (remote) server outputs this header, you can open a TCP connection
the remote server, send a HTTP Request, then read the HTTP Response.
From there, you can parse out the Last-Modified header and play your sound.
Example HTTP Request:
GET /showthread.php?t=26729 HTTP/1.0
Host: webmaster-forums.net
Example HTTP Response:
HTTP/1.1 200 OK
Date: Wed, 17 Nov 2004 03:16:41 GMT
Server: Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.3 FrontPage/5.0.2.2634 mod_ssl/2.8.15 OpenSSL/0.9.7a
X-Powered-By: PHP/4.3.3
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Wed, 17 Nov 2004 03:16:41 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: private, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: bblastvisit=1100661423; expires=Thu, 17-Nov-05 03:16:41 GMT; path=/
Set-Cookie: bblastactivity=1100660918; expires=Thu, 17-Nov-05 03:16:41 GMT; path=/
Set-Cookie: bbthread_lastview=ax1x-ix26729yix1100661423y_; path=/
Content-Length: 32646
Connection: close
Content-Type: text/html
*message body removed*
Note:
Each header line ends in \r\n (CR LF).
The header block is seperated from the body with an additional \r\n.
Mark Hensler
If there is no answer on Google, then there is no question.
Greg K posted this at 07:59 — 17th November 2004.
He has: 2,145 posts
Joined: Nov 2003
OFF TOPIC:
Renegade, thank you for posting the link to your site, as the last bit of code you had gave me a solution to something I had looked for in PHP: using the value of a variable to name a variable you want. (using the $$'s). I have been wanting to use that, I was used to being able to use "eval()" in another language.
(For those reading this and not knowing what I am talking about, try this example)
<?php
$greg = \"This is Greg\";
$varName = \"greg\";
echo \"the variable '$varName' = {$$varName} \n\";
// GIVE YOU:
// the variable 'greg' = This is Greg
?>
Where the heck is this in the PHP manual???? LOL
Again, thanks for the post, it lead me to an answer I have wanted for a while.
-Greg
(PS. yeah, i thought of asking about it on here, but never got around to it LOL)
Abhishek Reddy posted this at 11:46 — 17th November 2004.
He has: 3,348 posts
Joined: Jul 2001
http://www.php.net/manual/en/language.variables.variable.php
Greg K posted this at 15:09 — 17th November 2004.
He has: 2,145 posts
Joined: Nov 2003
Talk about lookng all over the place for your glasses when they are right on top of your head huh?
(note I did try to search for $$ in the manual did no good...)
Thanks.
-Greg
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.