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

Sending Error Codes

P: n/a
I am having trouble sending error codes to the
browser from my php page.

I want to send a 401 Unauthorized, and a 404 not found.

I have tried these (in seperate documents):

header("HTTP/1.0 404 Not Found");
header("Status: 401 Unauthorized");

I put a single header at the top of the page
but I received a blank document in return.

What else do I have to do send error responses
in PHP?

Thanks,

Andrew

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hmmmm...maybe this behaviour is correct?

Do I need to display my own error message or something?

Andrew
Andrew wrote:
I am having trouble sending error codes to the
browser from my php page.

I want to send a 401 Unauthorized, and a 404 not found.

I have tried these (in seperate documents):

header("HTTP/1.0 404 Not Found");
header("Status: 401 Unauthorized");

I put a single header at the top of the page
but I received a blank document in return.

What else do I have to do send error responses
in PHP?

Thanks,

Andrew


Jul 17 '05 #2

P: n/a
"Andrew" <an****@nowherenohow.com> wrote in message
news:%7*****************@newsread2.news.pas.earthl ink.net...
Hmmmm...maybe this behaviour is correct?

Do I need to display my own error message or something?

Andrew
Andrew wrote:
I am having trouble sending error codes to the
browser from my php page.

I want to send a 401 Unauthorized, and a 404 not found.

I have tried these (in seperate documents):

header("HTTP/1.0 404 Not Found");
header("Status: 401 Unauthorized");

I put a single header at the top of the page
but I received a blank document in return.

What else do I have to do send error responses
in PHP?


Indeed. You can print out as fancy a error message as you want. Personally I
just copy-and-pasted the HTML from the Apache error pages.
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.