Home » Php » php – Send HTTP 418 I'm a teapot

php – Send HTTP 418 I'm a teapot

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a web-server and I would like to have the HTTP status code 418 ‘I’m a teapot’ under some conditions, I am sure I would use an if statement, I just can’t seem to get it to trip, any help?

How to&Answers:
<?php
header("HTTP/1.1 418 I'm a teapot");
?>
<html>
<h1>418 I'm a teapot</h1><br>
<p>The HTCPCP Server is a teapot. The responding entity MAY be short and stout.</p>
</html>

Will result in:

418 I’m a teapot

The HTCPCP Server is a teapot. The responding entity MAY be short and stout.