예제 #1
0
echo "==========================================" . PHP_EOL . PHP_EOL;
try {
    echo "------------------------------------------" . PHP_EOL;
    echo " Test FileMaker object's main methods" . PHP_EOL;
    echo "------------------------------------------" . PHP_EOL;
    $fm = new FileMaker('filemaker-test', '192.168.1.22', 'filemaker', 'filemaker');
    /* API infos */
    echo "API version : " . $fm->getAPIVersion() . PHP_EOL;
    echo "Min server version : " . $fm->getMinServerVersion() . PHP_EOL . PHP_EOL;
    /* get databases list */
    echo "Get databases list...";
    $databases = $fm->listDatabases();
    echo implode(', ', $databases) . '...<span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
    /* get layouts list */
    echo "Get layouts list...";
    $layouts = $fm->listLayouts();
    if (sizeof($layouts) != 2) {
        echo '<span style="color:red">FAIL</span> !' . PHP_EOL;
        exit;
    }
    echo implode(', ', $layouts) . '...<span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
    /* get layouts list */
    echo "Get scripts list...";
    $scripts = $fm->listScripts();
    echo implode(', ', $scripts) . '...<span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
    /**
     * Test perform script
     */
    echo "Test perform function...";
    $command = $fm->newPerformScriptCommand($layouts[0], 'create sample data');
    $result = $command->execute();