Helpful hints when programming for Postback URL and DSU
Variables vs. Export Template
When using Postback URL you can define what your server receives based on an Export Template. However, for Direct Scan to URL (DSU) you will receive the default variables as noted below.
If you want to see what is posted to your server, you can put an ‘echo’ at the beginning of your postback. In that way the post received will be emailed to you. If placed at the beginning of your script you should still get the email even if there’s a problem with your script.
Though setting up an echo will vary based on your programming language, here’s one example:
mail(“firstname.lastname@example.org”, “Echo POSTBACK”, print_r($_POST,true));
Questions and Answers
Treat answers not as a plain array but as an associative array or a dictionary where the keys are question IDs.
A normal index array is this
answers = answer X
answers = answer Y
answers[n] = answer Z
We are not posting it that way. We are posting based on the questions created and assigned to the service. So given assigned questions with question id #1111 and #2222 to your service, when someone scans and submits the post will be
answers = answer for question id 1111
answers = answer for question id 2222
Note; You also need to consider when the answers are submitted. If you have pre-submit questions, the answers will come with the one post. If you have post-submit questions then you will receive two posts with the same ID for you to know the relation.