Which version of Storyline are you using? That code was designed to work with Storyline 1 and is unlikely to work with Storyline 2 without some serious work. As Dan mentioned, that code will need work anyway before using it in a production system.
What I recommend instead is to use the launch plugin here: https://github.com/garemoko/moodle-mod_tincanlaunch . Note that there's an open Pull Request to bring this plugin up to date with Moodle 2.7 that should be merged soon.
You can use this with an external LRS, e.g. a free SCORM Cloud account or an LRS hosted alongside Moodle.
Feel free to mail me andrew.downes@tincanapi.com if you have questions. I don't subscribe to Moodle forums (due to the wall of notifications) so may not see any reply here.