- Posts: 62
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
RemoteControl 2 API, export responses to elaborate in a PHP page
- Maverick87Shaka
- Topic Author
- Offline
- Senior Member
Less
More
7 years 11 months ago #136467
by Maverick87Shaka
RemoteControl 2 API, export responses to elaborate in a PHP page was created by Maverick87Shaka
Hi to all,
I've just start to write a PHP page to make a custom elaboration page.
I have enabled the API, and I 'm able to get some information, like the array with the survey list ( list_surveys ) and some other option, but when I try to get the responses ( and also a single resoults by token ) I have some problem.
I'm using CSV as documentType in export_responses_by_token and I would like to receive a "string" like the one generated by the "default" export function of Limesurvey, but the results it's a string without any "Separator", no code of the questionID or something that is "usable"
the output of my export PHP API is like:
instead of CSV export limesurvey:
I've just start to write a PHP page to make a custom elaboration page.
I have enabled the API, and I 'm able to get some information, like the array with the survey list ( list_surveys ) and some other option, but when I try to get the responses ( and also a single resoults by token ) I have some problem.
I'm using CSV as documentType in export_responses_by_token and I would like to receive a "string" like the one generated by the "default" export function of Limesurvey, but the results it's a string without any "Separator", no code of the questionID or something that is "usable"
the output of my export PHP API is like:
Code:
ImlkIiwic3VibWl0ZGF0ZSIsImxhc3RwYWdlIiwic3RhcnRsYW5ndWFnZSIsInRva2VuIiwiQU5BRzEiLCJBTkFHMiIsIlEwMVtTUTAwMV0iLCJRMDFbU1EwMDJdIiwiUTAxW1NRMDAzXSIsIlEwMltTUTAwMV0iLCJRMDJbU1EwMDJdIiwiUTAyW1NRMDAzXSIsIlEwM1tTUTAwMV0iLCJRMDNbU1EwMDJdIiwiUTAzW1NRMDAzXSIsIlEwNFtTUTAwMV0iLCJRMDRbU1EwMDJdIiwiUTA0W1NRMDAzXSIsIlEwNVtTUTAwMV0iLCJRMDVbU1EwMDJdIiwiUTA1W1NRMDAzXSIsIlEwNltTUTAwMV0iLCJRMDZbU1EwMDJdIiwiUTA2W1NRMDAzXSIsIlEwN1tTUTAwMV0iLCJRMDdbU1EwMDJdIiwiUTA3W1NRMDAzXSIsIlEwOFtTUTAwMV0iLCJRMDhbU1EwMDJdIiwiUTA4W1NRMDAzXSIsIlEwOVtTUTAwMV0iLCJRMDlbU1EwMDJdIiwiUTA5W1NRMDAzXSIsIlExMFtTUTAwMV0iLCJRMTBbU1EwMDJdIiwiUTEwW1NRMDAzXSIKIjEwIiwiMTk4MC0wMS0wMSAwMDowMDowMCIsIjMiLCJpdCIsIlN0bWVrUWdGc2pJbDN1MCIsIjE5ODctMDItMTQgMDA6MDA6MDAiLCJNIiwiNCIsIjMiLCIiLCI0IiwiMyIsIiIsIjMiLCI1IiwiIiwiNCIsIiIsIjMiLCI0IiwiIiwiMyIsIjQiLCIiLCIzIiwiMyIsIjQiLCIiLCI1IiwiNCIsIiIsIjQiLCIzIiwiIiwiMyIsIjQiLCIiCgo=
instead of CSV export limesurvey:
Code:
"10","1980-01-01 00:00:00","3","it","StmekQgFsjIl3u0","1987-02-14 00:00:00","M","4","3","","4","3","","3","5","","4","","3","4","","3","4","","3","3","4","","5","4","","4","3","","3","4","","name","name2","email","location","12/05/2016","attribute"
The topic has been locked.
- Maverick87Shaka
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 3
7 years 11 months ago #136470
by Maverick87Shaka
Replied by Maverick87Shaka on topic RemoteControl 2 API, export responses to elaborate in a PHP page
My fault, I forgot to decode the string!!!
You can close/remove the topics, sorry!
If anyone have the same problem, just use:
You can close/remove the topics, sorry!
If anyone have the same problem, just use:
Code:
$readableversion_decoded = base64_decode($result);
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
7 years 11 months ago #136496
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic RemoteControl 2 API, export responses to elaborate in a PHP page
No, because :Maverick87Shaka wrote: You can close/remove the topics, sorry!
+ 1 karmaMaverick87Shaka wrote: If anyone have the same problem, just use:
Code:$readableversion_decoded = base64_decode($result);
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- Maverick87Shaka
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 3
7 years 11 months ago #136552
by Maverick87Shaka
Replied by Maverick87Shaka on topic RemoteControl 2 API, export responses to elaborate in a PHP page
Hi, I'm back!
I'm going to use this already made topic to ask you a tips.
I've finally get my json string, what I would like to do is create a script to elaborate given answer as soon as one users complete the survey.
I have my full "static" script working, static because currently I'm working on a prior known structure of a json file, given by
In this structure there is the "response id" that I don't know how to know "dynamically".
I'm using this code:
Where 17 is the ID, but how to get the value of "Q02[R4]" whichever ID be?
I'll try to use special character ( Wildcard * ) but doesn't work => Decoded_Response[0][*]']
There is a way to know the ID from token value using the API? maybe I can call before another API to use to save the ID in a variable from Token?
The token is already "dynamically" passed to the script using the "token table" feature,
I'm going to use this already made topic to ask you a tips.
I've finally get my json string, what I would like to do is create a script to elaborate given answer as soon as one users complete the survey.
I have my full "static" script working, static because currently I'm working on a prior known structure of a json file, given by
Code:
export_responses_by_token
I'm using this code:
Code:
$r04 = $Decoded_Response['responses'][0][17]['Q02[R4]'];
I'll try to use special character ( Wildcard * ) but doesn't work => Decoded_Response[0][*]']
There is a way to know the ID from token value using the API? maybe I can call before another API to use to save the ID in a variable from Token?
The token is already "dynamically" passed to the script using the "token table" feature,
Code:
{TOKEN:TOKEN} )
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
7 years 11 months ago #136656
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic RemoteControl 2 API, export responses to elaborate in a PHP page
By "ID", do you mean the token ID or the response ID? If it's the response ID, you should be able to pass it to your script with the {SAVEDID} placeholder.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Maverick87Shaka
The topic has been locked.
- Maverick87Shaka
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 3
7 years 11 months ago #136714
by Maverick87Shaka
Thanks!
Replied by Maverick87Shaka on topic RemoteControl 2 API, export responses to elaborate in a PHP page
Sorry, I was not very clear, what I need for my script is the ResponseID, and I've already tested the {SAVEDID} placeholder works fine!tpartner wrote: By "ID", do you mean the token ID or the response ID? If it's the response ID, you should be able to pass it to your script with the {SAVEDID} placeholder.
Thanks!
The topic has been locked.
- Maverick87Shaka
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 3
7 years 11 months ago #136788
by Maverick87Shaka
Replied by Maverick87Shaka on topic RemoteControl 2 API, export responses to elaborate in a PHP page
I'm here again, in the jason returned string there is another ID that I don't know what is, {SAVEDID} it's ok and work fine with my script, actually i've another problem with a ID that I need to pass to my php.
To understand what I mean see the attached picture.
The JSON received by:
To understand what I mean see the attached picture.
The JSON received by:
Code:
export_responses_by_token
Attachments:
The topic has been locked.