Jonathan Jeffery

Filemaker PHP custom web publishing fails

Discussion created by Jonathan Jeffery on Oct 23, 2015
Latest reply on Oct 28, 2015 by Jonathan Jeffery

FileMaker Server 14.0.3.302

Win Server 2012 R2

 

When I try to connect to a database via the PHP API, I get the return

"XML error: Not well-formed (invalid token) at line 1"

 

I have tried various databases (including ones made just for testing)

 

The API is undoubtedly functioning, as I can get the API version, and I receive appropriate error messages if I change the IP.

 

However, any other request returns the error above.

 

I've found this error reported occasionally on forums, for different versions of filemaker, but never with a resolution.

 

A basic php script would look like this:

// 1a. Include the FileMaker PHP API

$File = "FileMaker.php";

require_once ($File);

 

// 1b. Set DB values

$FM_IP =  '127.0.0.1' ;

$FM_File =  'TestOfPHP.fmp12' ;

$FM_User = "User";

$FM_Pass = "Password" ;

 

// 2. create the FileMaker Object

$fm = new FileMaker( $FM_IP, $FM_File, $FM_User , $FM_Pass );

$AIPversion = $fm->getAPIVersion () ;

 

// 3. check username and password

// create 'find all' object for $fm and execute

$logon_test = $fm->newFindAnyCommand('Test'); //set find method

$logon_result = $logon_test->execute(); //execute find method

 

// if no log-in, $logon_result will be an FM_ERROR object

if (FileMaker::isError($logon_result)) {

  $ErrorMessage = $logon_result->getMessage() ;

  die( $ErrorMessage );

  }


I've already checked:

1. The username/password is correct

2. The user privset has access via PHP web publishing

3. The correct ports are all open ( error occurs even if the firewall is switched off)

 

My FM server has an SSL certificate installed, and it is working fine for Filemaker client connections (I get the green padlock), but interestingly, when I test the technologies via the admin console, the php test uses the IP address, not the host name, and complains about the SSL host name (the certificate includes both DNS name and machine name in the Subject Alternate Name setting)

Outcomes