HTML's stateless world
Posted: Tue Feb 03, 2004 5:07 am
Hi,
This question concerns HTML's statelessness and using php to get and act on a response from a remote server.
I'm designing a form which will post to a remote database not under my control. The fields will be posted after a form has been filled. There are a number of 'status' messages supplied by the remote server as to whether or not the posting was successful, such as 'limit of postings exceeded', 'Success', 'Invalid field' etc. I can of course pre-check the form for field validation so that no incorrect data is sent, but some of the errors are not possible to check from the client side. The idea of the error messages are that the user can then act appropriately in response to the message. I would like to automate this response.
My question is:
Because http is stateless, is it possible to trap the error messages/responses from the remote server and use them in my code to make a predetermined reaction to the error programmatically. For instance if the server reports 'Error - 123, Number of allowed posts exceeded' , can I get at this information from the client side? I suppose it would be like reacting to a standard 404 error and interpreting that in my php script. Do I need to involve session variables etc.? Not looking for script, just a point in the right direction
This question concerns HTML's statelessness and using php to get and act on a response from a remote server.
I'm designing a form which will post to a remote database not under my control. The fields will be posted after a form has been filled. There are a number of 'status' messages supplied by the remote server as to whether or not the posting was successful, such as 'limit of postings exceeded', 'Success', 'Invalid field' etc. I can of course pre-check the form for field validation so that no incorrect data is sent, but some of the errors are not possible to check from the client side. The idea of the error messages are that the user can then act appropriately in response to the message. I would like to automate this response.
My question is:
Because http is stateless, is it possible to trap the error messages/responses from the remote server and use them in my code to make a predetermined reaction to the error programmatically. For instance if the server reports 'Error - 123, Number of allowed posts exceeded' , can I get at this information from the client side? I suppose it would be like reacting to a standard 404 error and interpreting that in my php script. Do I need to involve session variables etc.? Not looking for script, just a point in the right direction