Let me start by saying I can just about read PHP code. I got somebody to write some PHP code for formaLMS's API. (This person is no longer available to help me.)
For the most part, the code is working beautifully. I do however need help securing this with a token. Can somebody explain how to modify the below code and how to set it up in the LMS's API Authentication method?
I did read the new API documentation but I can't figure it out.
Here is the code I got. Any help would be greatly appreciated.
Code: Select all
<?php $url = "https://demo.formalms.com:443/"; $action = 'user/updateuser'; $data_params = array('idst' => 11836, 'lastname' => 'Doe'); $curl = curl_init(); $opt = array( CURLOPT_URL=>$url.'/api/'.$action, CURLOPT_RETURNTRANSFER=>1, CURLOPT_POST=>1, CURLOPT_POSTFIELDS=>$data_params, CURLOPT_CONNECTTIMEOUT=>5, // Timeout to 5 seconds CURLOPT_SSL_VERIFYPEER => 'false', ); curl_setopt_array($curl, $opt); // $output contains the output string $output = curl_exec($curl); // it closes the session curl_close($curl); echo $output;