3.1. Getting results with POST or GET
To receive results in your script:
- turn on “Enable API” in the survey settings;
- choose POST or GET as the method;
- enter the full URL of your script as the Result URL
(for example, https://example.org/result.php).
Simpoll then sends a POST (or GET) request to that URL every time someone completes the survey.
Example of the data sent:
POST:
(
[sp_survey_id] => 551
[sp_survey_key] => aa7ca07e
[sp_resp] => Array
(
[id] => 172693
[ip_addr] => 127.0.0.1
[name] => Respondent No.172693
[time_start] => 2011-12-13 13:23:24
[time_end] => 2011-12-13 13:23:45
[time_delta] => 00:00:21
[quiz_passed] => 0
[quiz_percent] => 33
[quiz_correct] => 3
[quiz_wrong] => 2
)
[sp_result] => 1
[sp_answers] => Array
(
[1] => Array
(
[0] => Italy
)
[2] => Array
(
[0] => Pyramids
[1] => Kremlin
[2] => Colosseum
[3] => Eiffel Tower
)
)
)
3.2. Parameters
- sp_survey_id — survey ID in Simpoll
- sp_survey_key — the key used in the survey URL
-
sp_resp — information about the respondent:
- id — respondent ID in Simpoll
- ip_addr — IP address of the respondent
- name — respondent name
- time_start — when the survey was started
- time_end — when the survey was finished
- time_delta — time spent on the survey
These fields are sent only for quizzes:- quiz_passed — whether the quiz was passed (1 = yes, 0 = no)
- quiz_percent — percentage of correct answers (0–100)
- quiz_correct — number of correct answers
- quiz_wrong — number of wrong answers
- sp_result — the survey was completed (always 1)
- sp_answers — the answers: keys are question numbers, values are arrays of answers to each question