I'm having a lot of trouble getting core_course_import_course or core_course_duplicate_course working.
No matter what I try for parameters I always get the fault string "Calling parameters do not match the signature.
I've found a few example of these function in the tracker but still no joy.
I'm testing on moodle 2.6 and I have other functions working. core_course_create_courses and core_course_create_categories are both working as expected.
I've tested both with and without "options". I also tried quoting the 1s for options because the documentation says theya re to be strings and not integers. That didn't work either.
If anyone can shed some light on what I'm doing wrong setting the parameters for these functions I'd greatly appreciate it. The two functions are very similar and I'm guessing I have the parameter structure wrong for both.
Here is the most recent failed attempt on core_course_import_course.
$params['importfrom'] = 4; $params['importto'] = 6; $params['deletecontent'] = 1; $params['options'][0]['name'] = 'activities'; $params['options'][0]['value'] = '1'; $params['options'][1]['name'] = 'blocks'; $params['options'][1]['value'] = '1'; $params['options'][2]['name'] = 'filters'; $params['options'][2]['value'] = '1';
This should be the same and it didn't work either.
$params = array('importfrom' => 4, 'importto'=> 6, 'deletecontent'=>1, 'options'=>array(array('name'=>'blocks', 'value'=>'1'), array('name'=>'activities', 'value'=>'1'), array('name'=>'filters', 'value'=>'1')) );
Sending the requests with this member of a class I made based on the example client provided
$response = $moodle->sendRequest('core_course_import_course',$params); function sendRequest($functionname,$params){ /// XML-RPC CALL header('Content-Type: text/plain'); $path = $this->server.$this->dir."/webservice/xmlrpc/server.php?wstoken=".$this->token; $curl = new curl; $post = xmlrpc_encode_request($functionname, array($params)); $resp = xmlrpc_decode($curl->post($path, $post)); var_dump($params); print_r($resp); if(isset($resp['faultCode'])): error_log('faultCode '.$resp['faultCode'].' faultString '.$resp['faultString']); return false; else: return $resp; endif; }