Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Error with remote control

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208618 by davebostockgmail
Error with remote control was created by davebostockgmail
I am having an issue with the Remote control API returning a session key via PHP, I have seen this asked before but not found an answer ...

I upgraded to Version 3.25.1+201124 this morning in the hopes that it would resolve the issue but with no luck.

I have tested using a simple script from the manual ...

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// without composer this line can be used
// require_once 'path/to/your/rpcclient/jsonRPCClient.php';
// with composer support just add the autoloader
require_once '../application/libraries/jsonRPCClient.php';

define( 'LS_BASEURL', 'https://serverURL/index.php/'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'user' );
define( 'LS_PASSWORD', 'password' );


// the survey to process
$iSurveyID = surveyid;

// instantiate a new client
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'admin/remotecontrol' );

// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );

// receive surveys list current user can read
$groups = $myJSONRPCClient->list_surveys( $sessionKey );
print_r($groups, null );

// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
?>

But I keep getting the same error.


Fatal error: Uncaught Exception: Incorrect response id: (request id: 1) in /var/www/html/application/libraries/jsonRPCClient.php:192 Stack trace: #0 /var/www/html/survey/test.php(22): jsonRPCClient->__call('get_session_key', Array) #1 {main} thrown in /var/www/html/application/libraries/jsonRPCClient.php on line 192

I have checked and I have remote control turned on in the settings and I have rebooted the servers all to no avail.

Does anyone know of a solution to this?

Thanks
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 5 months ago #208619 by DenisChenu
Replied by DenisChenu on topic Error with remote control

define( 'LS_BASEURL', 'https://serverURL/index.php/'); // adjust this one to your actual LimeSurvey URL
// instantiate a new client
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'admin/remotecontrol' );


No … it can be false and totally something else (and can explain the issue you have). Check the real url in the admin page, and use it directly.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #208621 by tpartner
Replied by tpartner on topic Error with remote control
I use this:

Code:
// Instantiate a new RPC client
    $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );

- forums.limesurvey.org/forum/can-i-do-thi...-access-token#204528

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 5 months ago #208622 by DenisChenu
Replied by DenisChenu on topic Error with remote control

tpartner wrote: I use this:

Code:
// Instantiate a new RPC client
    $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );

- forums.limesurvey.org/forum/can-i-do-thi...-access-token#204528

Yes, but it can be false… with url as GET

Can be

/index.php?r=admin/remotecontrol
/?r=admin/remotecontrol
/index.php/admin/remotecontrol
/admin/remotecontrol

:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208623 by davebostockgmail
Replied by davebostockgmail on topic Error with remote control
I have tried both yours and Denis' changes and still get the same error.

The PHP version we are running is 7.3 ... would that make any difference?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 5 months ago #208624 by DenisChenu
Replied by DenisChenu on topic Error with remote control
Did you look at your config ?
You don't have to try : you must be sure :)

www.limesurvey.org/manual/Global_settings#Interfaces

It's activated ?

If you activate Publish API : you see the page ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208626 by davebostockgmail
Replied by davebostockgmail on topic Error with remote control
it is all on as far as I can see.
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208627 by davebostockgmail
Replied by davebostockgmail on topic Error with remote control
And when i go to the page I see the list of the commands for the API
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208679 by davebostockgmail
Replied by davebostockgmail on topic Error with remote control
I have managed to work around the issue I have with PHP and SQL. I wanted to add data to the participant table with a known TOKEN id.

Over the holidays we are going to rebuild the servers with the latest version and hopefully this will fix the issues we are having.

Thanks for your thoughts on this

Dave
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 5 months ago #208681 by DenisChenu
Replied by DenisChenu on topic Error with remote control
Else : did server log (where limesurvey are) show something ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 5 months ago #208683 by davebostockgmail
Replied by davebostockgmail on topic Error with remote control
Not that I could see Denis.

I think that this along with the error I have with comfort update are indicative of an error in our site installation ... so a clean build should hopefully resolve any issues we have.

Our IT team recently went on an exercise where they updated all the firewall rules both external and internal and this is when the issues started appearing so I am assuming that this may be the root cause.

A clean installation on new VM's would allow me to test without any rules being in place and then I can work through the rules they apply to see if any of those impacted the survey VM.

If I do find out anything then I will report back here in case others have a similar issue.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 5 months ago #208689 by DenisChenu
Replied by DenisChenu on topic Error with remote control

davebostockgmail wrote: Our IT team recently went on an exercise where they updated all the firewall rules both external and internal and this is when the issues started appearing so I am assuming that this may be the root cause.

OK :)

Surely you can't get limesurvey sezrver url from the other server.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose