PHP code example of asifm42 / scorm-cloud-php

1. Go to this page and download the library: Download asifm42/scorm-cloud-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asifm42 / scorm-cloud-php example snippets


$scormCloud = new AsifM42\ScormCloud\ScormEngineService(
    "https://cloud.scorm.com/EngineWebServices",
    "your app id",
    "your secret key",
    "your origin string");

$exists = $scormCloud->getRegistrationService()->Exists("reg id");

$scormCloud->getRegistrationService()->CreateRegistration(
    "registration id",
    "course id",
    "learner id",
    "learner first name",
    "learner last name");


$launchUrl = $scormCloud->getRegistrationService()->GetLaunchUrl(
    "registration id",
    "redirect on exit url");


header('Location: ' . $launchUrl);
die();

$request = $scormCloud->CreateNewRequest();

$request->setMethodParams(array(
    'regid' => 'your reg id'
));

$response = $request->CallService("rustici.registration.exists");
$xml = simplexml_load_string($response);

$exists = ($xml->result == 'true');