Table of Contents
In this chapter we're going to talk about the basic first
steps in making use of the WACS API from your own programs. We're
going to assume that you've got a WACS server you can use up and
running; that you know where things are on it and that you have
appropriate write access to the web document tree (if you're working
in PHP) or the cgi-bin directory (if you're working in Perl). Hopefully
you'll have both some models and a few image sets known in the WACS
system to work with. For these first code examples, you could merely
load the sample model profiles we've provided in the samples
directory of the WACS distribution.
While the finished code of the sample programs featured here is
available in the samples directory of the WACS Core distribution (for
the Perl verion) or the WACS-php distribution (for the PHP5 version),
you may wish to type it in as you go along as an aid to learning how
to use the interface. If you do, we'd recommend calling this file
mysimple
for perl, or mysimple.php
for PHP. For consistency, we're going to put the PHP dialect first and
then the Perl dialect in each of the examples.
The basic structure of your first WACS application will consist of five steps; these are:
import the WACS API modules
read configuration and check access rights
initialise the database connection
run an appropriate database query
retrieve records and display them