How do I make php page return a 503 error (or anything non-200).

Posted by Benju on Stack Overflow See other posts from Stack Overflow or by Benju
Published on 2010-05-03T20:11:00Z Indexed on 2010/05/03 20:18 UTC
Read the original article Hit count: 225

Filed under:
|

A former developer wrote or client-server api in PHP. It simply sends messages as xml using post/response in a very simplistic fashion. The problem is that even when there is an error (ex: invalid arguments passed into the server side) we get a HTTP 200 response with a page like this

<h4>Unknown error!</h4>

In firebug I can see that the actually HTTP response is a 200. How can we send a different response (ie:503) when we programatically detect in our php code that it is appropriate to do so.

© Stack Overflow or respective owner

Related posts about php

Related posts about http