Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache/Response String/CGI

Status
Not open for further replies.

dbeyer

IS-IT--Management
Nov 15, 2007
3
US
Hi,

I'm pretty new to CGI/Apache programming... but I think this should be fairly easy for the right person:

How do I set a custom (non-default) response string (or value) to be returned by my cgi script?

Right now...200 is returned all the time..unless the script fails for some reason..and then the 500 (going from memory) is returned.

can the cgi "die" be used somehow - with my changing the response value?...or is there another way?

My app is doing credit card verifications..and I want to return say one value for authorized and other for declined.

I've done a bit of research...and tried a few things..but, it's always 200 or 500 no matter what I try.

Thanks in advance for your help.

David Beyer
voice_personals@hotmail.com
 
First of all, what is your CGI programming language? The answer will have to be specific to your language.
 
I'm sorry -

I am coding in PERL. The .cgi is run on an apache web server.

Thanks for your attention.

David Beyer
 
So, I guess you've tried the obvious:

print &quot;Status: <your status number> <your status text>\n\n&quot;;

And it did not work, correct?
 
The status is in the very first line that the server outputs, it should look something like this
HTTP/1.1 (status code) (status text)
I don't know if PERL can modify it, but it should be able to.
You should also read chapter 10 of RFC2616 (available at which contains all the HTTP/1.1 status codes and status texts. //Daniel
 
Oh, I see your problem.

But I'm confused. I don't really see why you'd want to do that. The status of the transaction is for the benefit of the browser, not the user. And if you had a CGI calling that CGI, then you could put a custom HTTP header in the return stream that would transport the information you want. Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
Thanks for all your help. It was what I needed to get
my problem solved.

Thanks to all.

David Beyer
 
In the interests of making the information available to the next guy who asks this question, what was your solution? Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top