How to tell?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

How to tell?

Post by Monotoko »

Hi guys, I have just added this to the top of one of my pages:

Code: Select all

<?php
$expires = 60*60*24*14;
header("Pragma: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
?>
How do I tell if the caching is working? One of my scripts is causing a problem with the server its hosted on because bots keep on hitting it from the same IP, so I was thinking a cache would help.

Daniel
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: How to tell?

Post by John Cartwright »

It is completely up to the client, or in your case a bot, to obey the caching rules.
Post Reply