简体   繁体   English

FileMaker PHP API连接问题

[英]FileMaker PHP API Connection Issue

I have recently created a script which should be passed an IP address of the users FM DB Server location, then the script will connect to that server with the given username, password, IP Address and DB Name. 我最近创建了一个脚本,该脚本应该传递给用户FM DB Server位置的IP地址,然后该脚本将使用给定的用户名,密码,IP地址和数据库名称连接到该服务器。

However, no matter what I pass as the IP, it never throws an error. 但是,无论我作为IP传递什么,它都不会抛出错误。

Is there some form of error handling within the FileMaker PHP API for connection errors? FileMaker PHP API中是否存在某种形式的针对连接错误的错误处理?

Thanks in advance! 提前致谢!

All the FileMaker API calls return an result object in case of error. 发生错误时,所有FileMaker API调用都会返回结果对象。 You should try this: 您应该尝试这样:

Here is an example: 这是一个例子:

$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"; 

The server that you're making the calls from needs to have curl support - make sure that's enabled. 您从中进行呼叫的服务器需要卷曲支持-确保已启用它。 Best bet is to try locally against your FMS box with the test database - once you've got that working then you can try the remote connection. 最好的选择是在带有测试数据库的FMS盒上进行本地尝试-一旦工作正常,就可以尝试远程连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM