示例#1
0
 static function AppStartup()
 {
     return OTAPI_Basic_AppStartup();
 }
#!/usr/bin/env php
<?php 
function getInput($msg)
{
    fwrite(STDOUT, "{$msg}");
    $varin = trim(fgets(STDIN));
    return $varin;
}
$path = 'C:\\Users\\JSpit-PC\\AppData\\Roaming\\OpenTransactions';
// NOTE: This unlink is unnecessary as long as we are properly calling
// OTAPI_Basic_AppShutdown() at the bottom of this file (and we are...)
//
//  $a = unlink($path . '\\client_data\ot.pid');
$nb = getInput("\n\nBefore running this script, I had to copy\n /Users/au/.local/lib/libotapi-php.dylib to:\n /usr/local/lib/php/extensions/no-debug-non-zts-20090626 \n I figured out the folders based on PHP complaining when it could find otapi.so.\nYou might have to do something similar so your PHP can find the otapi.\nOh and also, I had to rename libotapi-php.dylib to otapi.so.\nI also had to copy otapi.php (from SWIG) into this folder.\n\nAlso, make sure the server is running (otserver)\n\nOkay, ready to test?\nPress enter TWICE to try out the OT API... ");
include "otapi.php";
OTAPI_Basic_AppStartup();
# These functions are perfect examples of the 'Low-level API',
# which is useful for simple functions that don't require messaging
# any OT servers. See OTAPI_Basic.h and OTAPI.h for the complete
# low-level API.
OTAPI_Basic_Init();
date_default_timezone_set('UTC');
$tm = OTAPI_Basic_GetTime();
$date = date("d/m/Y H:i:s", $tm);
echo $tm . " = " . $date . "<br>";
OTAPI_Basic_SetWallet('wallet.xml');
if (!OTAPI_Basic_WalletExists()) {
    die(' wallet not found<br>');
} else {
    echo ' wallet exists.<br>';
}