Laravel Copy-Survey - Copiando uam Survey atraves de uma API - RESOLVIDO

More
10 months 5 days ago #188380 by avelar
Preciso criar uma API, usando o comando copy-Survey, para copiar uma survey automaticamente, estou perdido, poderiam me ajudar?

public function CopiarPesquisa()
{
$limeSurvey = new LimesurveyApiHandle(Config::get('limesurveyApiHandle.url'), Config::get('limesurveyApiHandle.username'), Config::get('limesurveyApiHandle.password'));

$iSurveyID_org = 516357;
$sNewname = 'copia da Pesquisa 516357';


if(ctype_alnum($iSurveyID_org) && strlen($iSurveyID_org == 6)) {

$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );

$sSessionKey= $myJSONRPCClient->get_session_key();

if(is_array($sSessionKey)) {
echo $sSessionKey;
}
else if($sSessionKey) {

// copiar pesquisa
$newSurvey = $myJSONRPCClient->copy_survey($sSessionKey, $iSurveyID_org, $sNewname);

// imprimir o resultado da copia.
print_r($newSurvey);
}

$myJSONRPCClient->release_session_key( $sSessionKey );
}
else { // Invalid SID format
die( 'Invalid format!' );
}

Obrigado.

AAvelar

Please Log in to join the conversation.

More
10 months 5 days ago #188389 by avelar
public function getCopiarPesquisa()
{
$limeSurvey = new LimesurveyApiHandle(Config::get('limesurveyApiHandle.url'), Config::get('limesurveyApiHandle.username'), Config::get('limesurveyApiHandle.password'));

$iSurveyID_org = 516357;
$sNewname = 'copia da Pesquisa 516357';

$newSurvey = $limeSurvey->copy_survey($iSurveyID_org, $sNewname);

print_r($newSurvey);
}

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now