Currently using LimeSurvey Version 2.57.1+161205
I'm using the Remote Control API to upload LSS survey files on demand.
I use 3 API calls:
in that order.
It's been working fine, but now I'm finding a very strange issue. Previously this particular LSS file uploaded fine without a problem, but now I get an exception:
fopen(https://some.server.com/lime/admin/remotecontrol): failed to open stream: HTTP request failed!
(some.server.com is made up, the actual domain does exist and works fine)
If I log in to the admin portal for LimeSurvey, the survey has actually been created! But because it causes an exception the Survey ID is never returned by the API call import_survey, which makes the activate_tokens and activate_survey calls fail as well.
I'm using the JSON RPC library https://github.com/fguillot/JsonRPC
The LSS file is 631k in size, though not sure if this is an issue as the system successfully imported and activated 2 surveys that are 653k.
Side note: as I was typing this up I did another test run, this time the survey went through without a problem. This is very puzzling. Could there be some sort of timing issue here? About 5min ago, this survey failed, but now it went through. I've also tested this locally on my dev machine which is a Macbook Pro on Sierra, and some surveys do fail (the ones that fail happen to be over 600k).
Well this seems to be a timeout issue! The RPC Client I'm using has a default of 5 seconds. It looks like LimeSurvey takes more than 5 seconds to process LSS data over 600k (approximately). So when I instatiate the Client, I set the timeout to 60 seconds, eg
$this->ls_rpc_client = new JSONRPClient($api_url);
$this->ls_rpc_client->getHttpClient()->withTimeout(60);
Now my automated importer works without any errors anymore.