PHP API Kit v3 - Ultimate Setup

This is the setup guide for v3 of our PHP API Kit for Ultimate Detection.

Using Ultimate Detection you should be capable of detecting thousands of devices per second.

Ultimate detection is high performance and has no database dependencies however you will need to have the php-apc (php-apcu on PHP5.5+) and php-zip modules installed. Much of the API Kit's datafiles are cached in memory. You should set aside at least 80Mb of memory in your apc.ini for caching.

Step 1) See the PHP API Kit v3 Setup Guide to get your API Kit setup.
- Ensure your API Kit is configured properly and functioning correctly.

Step 2) Place your kit into local mode and run a few tests
- Edit your hdconfig.php file and change the 'use_local' setting to true. It will look like this :
$hdconfig['use_local']=true;

Step 3) Run the sites.php test.
- If this is the first time you've run that script then the first few commands will fail as the local files have not been downloaded yet.
- The API Kit has inbuilt functions to download the necessary files and install them for performing local detections. Use the siteFetchArchive() method to download the database and install files. This method replaces siteFetchTrees() and siteFetchSpecs() forn downloading the required files.

Notes :

The relevant part of the sites.php which downloads the detection database and files are these lines. Feel free to incorporate that into your own scripts or cron jobs.

 

// If your site has access to download our device specs database only.
// Note - Increase default timeout
echo "</p><h1>Archive Information</h1><p>";
$hd3->setTimeout(120);
if ($hd3->siteFetchArchive()) {
    $data = $hd3->getRawReply();
    echo "Downloaded ".strlen($data)." bytes";
} else {
    print $hd3->getError();
}
$hd3->setTimeout(60);
echo "</p>";
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk