For security, requests to a PHP webservice will require a Date: header.
I need to calculate if the Date: header is within 15 minutes of the computer clock.
I can easily do this by comparing
$dt = new DateTime($_SERVER['HTTP_DATE']);
to the actual date. However, strotime also supports formats such as “now”, which will always be ‘valid’.
Is there a straightforward way to make sure people specify an absolute date. Strictly checking RFC2616 is even better, but not a requirement.
See:
http://www.ietf.org/rfc/rfc2616.txt section 3.3.1
Did some research and it looks like you can solve this using strptime(). Note that this is untested, and I’m just guessing that strptime() will properly convert the string to GMT based on the supplied timezone. This should at least get you started.