- Posts: 5
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Fatal error: Uncaught Exception: Request error: attribute "Response_527793.527793X119X960962 is not defined. in C:\xampp\htdocs\JsonRPCClient.php:161 Stack trace: #0 C:\xampp\htdocs\auswertung.php(28): jsonRPCClient->__call('export_statisti...', Array) #1 {main} thrown in C:\xampp\htdocs\JsonRPCClient.php on line 161
<?php include 'functions.php'; define( 'LS_BASEURL', 'https://127.0.0.1/limesurvey-master'); define( 'LS_USER', 'admin' ); define( 'LS_PASSWORD', '******' ); $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); $sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); $sResult = $myJSONRPCClient-> export_statistics($sSessionKey,527793,"pdf"); $sResult = base64_decode($sResult); file_put_contents("auswertung/survey.pdf", $sResult); ?>
... require_once 'jsonrpcphp/JsonRPCClient.php'; define( 'LS_BASEURL', 'https://www.myServer.de/limesurvey'); // adjust this one to your actual LimeSurvey URL define( 'LS_USER', 'myUser' ); define( 'LS_PASSWORD', 'myPassword' ); // the survey to process $survey_id=886223; // instantiate a new client $myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // receive session key $sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); if(is_array($sessionKey)) { header("Content-type: application/json"); echo json_encode($sessionKey); echo '<br />This is another test with sesssion key.<br />'; die(); } else if($sessionKey) // Is a valid session { /* Get the responses */ $sResult = $myJSONRPCClient-> export_statistics($sessionKey,$survey_id,"pdf"); $sResult = base64_decode($sResult); file_put_contents("survey.pdf", $sResult); } // Release the session key $myJSONRPCClient->release_session_key( $sSessionKey ); ...