Welcome to the LimeSurvey Community Forum

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

api setup failing

  • Kabengwa
  • Kabengwa's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 5 months ago - 5 years 5 months ago #175645 by Kabengwa
api setup failing was created by Kabengwa
i have setup limesurvey before and it worked well am trying to set it up again on the same server just different docker container and it is refusing to work . it is throwing this and i dont know why. i have tried changing it in all ways i can. can someone help and point me to the right direction?
Code:
Fatal error: Uncaught Exception: Unable to connect to https://stage.my.limesurvey.site.com/admin/remotecontrol in /var/www/html/wp-content/themes/medzone-lite/vendor/weberhofer/jsonrpcphp/src/org/jsonrpcphp/JsonRPCClient.php:155 Stack trace: #0 /var/www/html/wp-content/themes/medzone-lite/testing.php(26): org\jsonrpcphp\JsonRPCClient->__call('get_session_key', Array) #1 /var/www/html/wp-includes/template-loader.php(74): include('/var/www/html/w...') #2 /var/www/html/wp-blog-header.php(19): require_once('/var/www/html/w...') #3 /var/www/html/index.php(17): require('/var/www/html/w...') #4 {main} thrown in /var/www/html/wp-content/themes/medzone-lite/vendor/weberhofer/jsonrpcphp/src/org/jsonrpcphp/JsonRPCClient.php on line 155

this is what i have setup.
Code:
include_once 'vendor/autoload.php';
 
define( 'LS_BASEURL', 'https://stage.my.limesurvey.site.com');  // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'user' );
define( 'LS_PASSWORD', 'pass' );
 
// the survey to process
$survey_id=481623;
 
// instantiate a new client
$myJSONRPCClient = new \org\jsonrpcphp\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 );


steps to reproduce

i create a wordpress container put out the volumes went to the theme folder executed composer require weberhofer/jsonrpcphp which created the vendor folder and then i created a template file add the code above.

where did i go wrong ?
Last edit: 5 years 5 months ago by Kabengwa. Reason: removing sensitive information
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose