By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,744 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,744 IT Pros & Developers. It's quick & easy.

PHP Returning a HTTP error

P: n/a
Hi,

I have a application that is accessing a php script via HTTP, and I will
need the script to return anything other than HTTP 200 OK, using PHP
occasionally.

What code can I use to make a HTTP error returned?

Thanks,

Ben
--
BWGames
to email change de.news to de-news
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
BWGames scribbled something along the lines of:
Hi,

I have a application that is accessing a php script via HTTP, and I will
need the script to return anything other than HTTP 200 OK, using PHP
occasionally.

What code can I use to make a HTTP error returned?

Thanks,

Ben


http://www.php.net/header

The header() function does pretty much what you want. Just find the
right header to send. For some real life examples, get a browser that
lets you look at the headers it receives and look at the log when
encountering exactly that error.

Note that you need to "fake" the error documents still, even if you send
the right header. MSIE might show the "friendly" MSIE-error pages
instead if the setting has not been deactivated, but most other browsers
will show what the server sends.

Take a look at the error documents that come with the server software
and just copy the markup to the php file.

--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.