metamolecular / chemcaster-php

A PHP Client for Chemcaster

This URL has Read+Write access

name age message
file LICENSE Loading commit data...
file README.rdoc
directory lib/
directory tests/
README.rdoc

Chemcaster PHP API

This is the PHP interface for the Chemcaster RESTful Web API. It consists of basic functionality needed to create applications using chemical structure registration, storage, imaging, and search.

Example Use

Connecting to the Service

   require_once '/path/to/chemcaster-php/lib/chemcaster.php';

   $service = Chemcaster_Service::connect('username', 'password');

Loading a Registry

   require_once '/path/to/chemcaster-php/lib/chemcaster.php';

   $service    = Chemcaster_Service::connect('username', 'password');
   $registries = $service->registries;
   $size       = $registries->size();
   $registry   = $registries[0];

Creating a Registry

   require_once '/path/to/chemcaster-php/lib/chemcaster.php';

   $service      = Chemcaster_Service::connect('username', 'password');
   $registries   = $service->registries;

   try {

    $new_registry = $registries->create( array( 'name' => 'CarboBlocks, Inc.', 'deletable' => FALSE ) );

   } catch (Chemcaster_CreationException $e ) {

      //...handle exception
      //echo $e->getMessage();
      //echo $e->http_error_code;
      //print_r( $e->http_errors );

   }