2
// $Id: kdbphp.php 598 2009-02-18 13:49:18Z s_voec01 $
3
// Author: Sebastian Voecking <sebastian.voecking@uni-muenster.de>
5
if (!extension_loaded("kdbphp")) {
6
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
7
if (!dl('php_kdbphp.dll')) return;
9
// PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
10
// It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
11
if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
12
if (!dl('kdbphp.so')) return;
14
if (!dl('kdbphp.'.PHP_SHLIB_SUFFIX)) return;
19
function vectori_to_array($v)
23
if (is_resource($v)) {
24
for ($i = 0; $i < vectori_size($v); $i++) {
25
$a[] = vectori_get($v, $i);
32
function vectori_from_array(array $a)
35
$r = new_vectori($size);
36
for ($i = 0; $i < $size; $i++) {
37
vectori_set($r, $i, $a[$i]);
47
function __construct()
49
$this->_cPtr = new_KDBPhp();
52
function GetRun($number)
54
$xml = KDBPhp_GetRun($this->_cPtr, $number);
55
$this->PrintXml($xml);
60
$xml = KDBPhp_ListRuns($this->_cPtr);
61
$this->PrintXml($xml);
64
function HaveData($from, $to)
66
return KDBPhp_HaveData($this->_cPtr, $from, $to);
69
function PrintXml($xml)
71
header("Content-type: text/xml");
72
header("Cache-Control: no-cache, must-revalidate");
73
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
78
function PrintError($error)
80
$xml = "<?xml version=\"1.0\"?>\n<result>\n";
81
$xml .= " <Error>$error</Error>\n</result>";
83
$this->PrintXml($xml);
b'\\ No newline at end of file'