FileMaker PHP API连接问题


FileMaker PHP API Connection Issue

我最近创建了一个脚本,该脚本应该传递给用户FM DB服务器位置的IP地址,然后该脚本将使用给定的用户名、密码、IP地址和DB名称连接到该服务器。

然而,无论我作为IP传递什么,它都不会抛出错误。

对于连接错误,FileMaker PHP API中是否有某种形式的错误处理?

提前感谢!

所有FileMaker API调用都会在出错时返回一个结果对象。你应该试试这个:

这里有一个例子:

$fm = new FileMaker();
// Set 'hostspec' property using setProperty()
$fm->setProperty('database', $fmConfig['db']);
$fm->setProperty('hostspec', $fmConfig['host']);
$fm->setProperty('username', $fmConfig['user']); 
$fm->setProperty('password', $fmConfig['pass']);
$dt = date('m/d/Y H:i:s', $myDate);
$freq = $fm->newFindCommand("myTestLayout_1.0") ;
$freq->addFindCriterion("ModificationTimeStamp", ">".$dt);
$result = $freq->execute();
if (FileMaker::isError($result)) {
    $ErrMsg = 'Error code: '.$result->getCode().' Message: '.$result->getMessage();
    throw new Exception ($ErrMsg);  
}
$foundRecords = $result->getRecords();
echo count($foundRecords)." records"; 

从中进行调用的服务器需要有curl支持-确保已启用。最好的办法是用测试数据库在本地对您的FMS盒子进行测试——一旦您完成了测试,您就可以尝试远程连接。