1 |
1
|
wheeler
|
tapir2flat.php: a simple script to
|
2 |
|
|
consume taiper web services and save the results in a delimited file,
|
3 |
|
|
one record per line. The current delimiter is backtick '`' but
|
4 |
|
|
that can be changed by changing the $seperator variable located
|
5 |
|
|
in configurableParams.php.
|
6 |
|
|
|
7 |
|
|
Command line useage:
|
8 |
|
|
php taiper2flat.php
|
9 |
|
|
|
10 |
|
|
dependencies:
|
11 |
|
|
php 5+
|
12 |
|
|
pear
|
13 |
|
|
HTTP_Request
|
14 |
|
|
|
15 |
|
|
I had to install pear and HTTP_Request before it would work (on Ubuntu):
|
16 |
|
|
sudo apt-get install php-http-request
|
17 |
|
|
|
18 |
|
|
This should install all dependencies, but just in case, the full dependency list is:
|
19 |
|
|
php-net-socket
|
20 |
|
|
php-net-url
|
21 |
|
|
php-pear
|
22 |
|
|
php-http-request
|
23 |
|
|
|
24 |
|
|
Necessary files:
|
25 |
|
|
tapir2flat.php: Driver file
|
26 |
|
|
configurableParams.php: File containing paramaters that can be configured
|
27 |
|
|
tapirRequestTemplate.php: Holds the template required to send a tapir request.
|
28 |
|
|
getAllConcepts.php: holds utility function to get all possible return values from tapir service.
|
29 |
|
|
|
30 |
|
|
Possible output files:
|
31 |
|
|
specieslink.txt: Where the retrieved records will be stored. Each line represents one record, delimited by whatever is configured as the delimitation paramater.
|
32 |
|
|
recordnum.dat: Holds the starting record number for the most recently sent request.
|
33 |
|
|
error.log: Where any errors will be recorded.
|
34 |
|
|
|
35 |
|
|
Possible configurations: see configurableParams.php as well.
|
36 |
|
|
The url of desired tapir service
|
37 |
|
|
Delimiter to be used to sperate data fields within each record
|
38 |
|
|
The filter sent to tapir service that specifies search parameters, in xml format. See http://www.tdwg.org/dav/subgroups/tapir/1.0/docs/tdwg_tapir_specification_2010-05-05.htm#toc47 for documentation on how to do this.
|