home > support > API > Marketplace API > PHP Client Library
The TourCMS API PHP Client Library class is intended to provide a simple wrapper for the TourCMS Marketplace API. It takes care of authentication and exposes wrapper functions for all methods currently available in the API.
Requires PHP 5 or above.
If you have a Supplier account please review the checklist at the top of the API information page.
If you have a Partner account you will need to connect to at least one Supplier who has products available. You can check by logging in to your Partner account and clicking "Search & Book". If you can see some products visible then you are good to go, if not you will need to connect to some additional Suppliers, or ask your existing connections to load some products.
// Include the TourCMS library
include 'tourcms.php';
object TourCMS ( int $mp, string $k [, string $res = "raw" ])
| $mp | Your Marketplace Partner ID. If you are a Supplier set this to 0, if you are a Partner then you can find your ID by logging in to TourCMS and checking the API settings page of your account. |
| $k | Your API Private Key. This can be found/set in the API settings page in your account. |
| $res | The result type you would like back. By default results will be returned as XML, specify "simplexml" if you would prefer to get a SimpleXML object back. The majority of examples on this site will use SimpleXML. |
// Create a new Instance of the TourCMS API class
$tourcms = new TourCMS(0, "YOUR_PASSWORD_HERE", "simplexml");
The simplest call is one to get back information on your current API rate limit:
// Set the Channel ID
// For Suppliers this can be found in the API settings page
// For Partners this will be 0
$channel_id = 0;
// Query the TourCMS API
$result = $tourcms->api_rate_limit_status($channel_id);
// Print out the remaining hits
print 'Remaining hits: '.$result->remaining_hits;
Output:
Remaining hits: 500
Additional PHP examples are available on the individual pages linked from the method list.
The library is provided under an MIT license which allows you absolute flexibility in re-use and distribution, you may use the library in your own closed source or open source applications. If you would prefer to receive the library under another license please contact us.
© 2003-2012 Travel UCD Limited. All rights reserved. TourCMS® is a registered trademark of Travel UCD Limited, United Kingdom. View Privacy policy.