2012-02-29 79 views
0

我最近创建了一个脚本,该脚本应该通过用户FM数据库服务器位置的IP地址,然后脚本将使用给定的用户名,密码,IP地址和数据库名称连接到该服务器。FileMaker PHP API连接问题

但是,无论我作为IP通过什么,它都不会抛出错误。

在FileMaker PHP API中是否存在某种形式的连接错误的错误处理?

在此先感谢!

+0

你能不能检查HTTP响应的状态码? – 2012-02-29 14:07:19

+0

我该怎么做呢? – DarkMantis 2012-02-29 14:18:41

+0

我不知道你的API是如何工作的...... – 2012-02-29 14:28:28

回答

1

您要拨打电话的服务器需要支持卷曲 - 请确保已启用。最好的办法就是在本地使用测试数据库在您的FMS服务器上进行尝试 - 一旦您有了这个工作,您就可以尝试远程连接。

2

所有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"; 
+0

哈哈谢谢,我不记得我确切的问题,但我认为我已经整理出来了我的API接口:https://github.com/DarkMantisCS/FileMaker-PHP-API-Interface,如果我记得没错,那就是我正在使用它:) – DarkMantis 2013-05-13 14:04:37