The sample parsings in this article are intended for informational purposes only.
Sample Parsing of Returned Key-Value Pairs from PHP Query Strings
The following PHP snippet fully parses the returned key-value pairs from Direct Post Handler query string and assigns it to an array called $output. Note that the $_REQUEST super global variable is not used in favor of directly parsing $_SERVER[QUERY_STRING] since $_REQUEST may contain extraneous information that is not needed.
<?php
parse_str( $_SERVER[QUERY_STRING], $output );
?>
Sample Parsing of Output with Errors Returned
Below is a sample array structure of the parse where errors were returned. In this particular case, the end-user selected credit card as form of payment, but failed to fill out the credit card fields.
Array
(
[inSessionID] => E6EEMVG6NRWN5QQE76TJ
[error_messages] => Array
(
[0] => Array
(
[error_key] => serveryoumustenterccnumber
[error_code] => 1010
[error_field] => cc_no
)
[1] => Array
(
[error_key] => servercvvmissing
[error_code] => 1010
[error_field] => cvv
)
[2] => Array
(
[error_key] => serverexpirationmonthmissing
[error_code] => 1010
[error_field] => cc_exp_mm
)
[3] => Array
(
[error_key] => serverexpirationyearmissing
[error_code] => 1010
[error_field] => cc_exp_yyyy
)
)
[errors] => 4
)