Colorado Timberline APIA Practical Guide to Successful Integration

Endpoint Setup

Default Endpoint (CT Provided)
Setting up the default endpoint in a PHP environment is straightforward. The directory structure of the client library has a www directory, that you basically just need to point a vhost’s DocumentRoot at (assuming you’re running Apache).
The drawback here is that if you’re using an MVC framework, this might not fit your paradigm very well. Most folks will likely want to create the endpoint using their favorite framework, which fortunately is also very easy!
Let’s assume you want to setup the default endpoint though, on a LAMP stack.

  1. Unpack library in (/var/www/ct-api-client below)
  2. Create vhost pointing at www directory
  3. Provide CT with endpoint URL, below

The vhost file should look something like this

    DocumentRoot "/var/www/ct-api-client/www"


		Order deny,allow
		allow from all
		AllowOverride none

    ErrorLog "/var/log/ct-api-client.error_log"
    CustomLog /var/log/ct-api-client.access_log combined

Custom Endpoint

Let’s see how you might handle this inside of one of your favorite PHP frameworks. Here’s an example using Code Igniter

class CtApiCallbackEndpoint extends Controller {
  public function CtApiCallbackEndpoint()
    // bootstrap ct client library (something like this)
    $sDir = 'path-to-ct-lib-root';
    ini_set('include_path', ini_get('include_path') . ":$sDir");

   * presuming the ct client library has been properly bootstrapped,
   * you can simply invoke the CtApiFactory::createCallback() method.
   * if your library doesnt expose direct access to $_POST, just pass in the
   * value of $_POST['xml'] to the execute() method using the api your
   * framework provides

  public function index()