Please see viewtopic.php?f=4&t=10627#p26647

In case you'd still like to delve deeper into integration with raw PHP, perhaps the following discussion would also help -
viewtopic.php?f=2&t=10763