- Posts: 33
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Create token on the fly
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
6 years 11 months ago #153264
by badronald
Create token on the fly was created by badronald
I need to create tokens on the fly.
I used to do this with newtoken.php but that does not seem to work with 2.06
I have participants register for survey 1 depending on how they answer they need to go on to survey1 or survey2 immediately with the same token.
How can I do this?
I have been searching the forums for hours.
I used to do this with newtoken.php but that does not seem to work with 2.06
I have participants register for survey 1 depending on how they answer they need to go on to survey1 or survey2 immediately with the same token.
How can I do this?
I have been searching the forums for hours.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 11 months ago - 6 years 11 months ago #153266
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 Create token on the fly
You can use the
RemoteControl 2 API
to create tokens.
Related post - www.limesurvey.org/forum/can-i-do-this-w...s-to-a-survey#149782
Related post - www.limesurvey.org/forum/can-i-do-this-w...s-to-a-survey#149782
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 11 months ago by tpartner.
The following user(s) said Thank You: badronald
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
6 years 11 months ago #153269
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on topic Create token on the fly
Hi. I have a plugin which can help.
Please contact me at gabriel@encuesta.biz
Thanks
Please contact me at gabriel@encuesta.biz
Thanks
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 11 months ago #153373
by badronald
Replied by badronald on topic Create token on the fly
I cannot seem to figure out how to use the remote control feature . But I appreciate the feedback, thank you!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 11 months ago #153395
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 Create token on the fly
Did you try the linked example? If so, how did it fail?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 11 months ago #153426
by badronald
Replied by badronald on topic Create token on the fly
It is ok. It is just me. I do not have the time right now to figure out how to use the remote control system. I enabled it in limesuvey. But from there I am lost. I am not familiar with APIs.
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 11 months ago - 6 years 11 months ago #153478
by badronald
Replied by badronald on topic Create token on the fly
I just keep getting this error"
Warning: require_once(/application/libraries/jsonRPCClient.php) [function.require-once]: failed to open stream: No such file or directory in /home/nhs2/public_html/limesurvey206/admin/remotecontrol/newtoken.php on line 3
Fatal error: require_once() [function.require]: Failed opening required '/application/libraries/jsonRPCClient.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nhs2/public_html/limesurvey206/admin/remotecontrol/newtoken.php on line 3
Warning: require_once(/application/libraries/jsonRPCClient.php) [function.require-once]: failed to open stream: No such file or directory in /home/nhs2/public_html/limesurvey206/admin/remotecontrol/newtoken.php on line 3
Fatal error: require_once() [function.require]: Failed opening required '/application/libraries/jsonRPCClient.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nhs2/public_html/limesurvey206/admin/remotecontrol/newtoken.php on line 3
Last edit: 6 years 11 months ago by badronald.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 10 months ago #153494
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 Create token on the fly
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 10 months ago #153502
by badronald
Replied by badronald on topic Create token on the fly
I finally got it!
thank you
thank you
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 10 months ago #155043
by badronald
Replied by badronald on topic Create token on the fly
Can I pass user token into url after registration? Using Remote Control 2?
The topic has been locked.
- badronald
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 9 months ago #155468
by badronald
Replied by badronald on topic Create token on the fly
I am trying to understand how this works....sorry for my confusion....I got the code working....after I have participants register, I would need to write code in AJAX to connect to the remotecontrol code page in order to have in run and insert the token into the token table?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 9 months ago - 6 years 9 months ago #155472
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 Create token on the fly
Yes, if you need to make an AJAX call from your website or application, it would look something like this:
Then you would need to redefine the variables in the PHP file to access the GET values something like this:
More info on jQuery AJAX here - api.jquery.com/jquery.ajax/
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify some vars... var apiFilePath = 'http//path/to/api/file.php'; var sid = 123456; var token = 'ABCDE'; var email = 'example@example.com'; var firstName = 'Fred'; var lastName = 'Flinstone'; // AJAX call $.ajax({ url: apiFilePath, // Path to the PHP file async: true, cache : false, // No caching in IE data: { sid: sid, token: token, email : email, firstName: firstName, lastName: lastName }, success: function(results){ // Do something with the returned results of the AJAX call }, error: function(){ alert('Could not connect!'); } }); }); </script>
Then you would need to redefine the variables in the PHP file to access the GET values something like this:
Code:
$iSurveyID = $_GET["sid"]; $token = $_GET["token"]; $email = $_GET["email"]; $LastNameAPI = $_GET["firstName"]; $FirstNameAPI = $_GET["lastName"];
More info on jQuery AJAX here - api.jquery.com/jquery.ajax/
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 9 months ago by tpartner.
The topic has been locked.