The FileMaker Source
The FMT FileMaker Network

Filemaker PHP API – Creating Records

  • Posted In: FileMaker Pro Server and Networking


  • Member
    #32891

    I have my filemaker solution hosting in a filemaker server. I want to use a php script to fetch some data from my database and then create some records.

    How can I connect a php file with the filemaker solution hosted in filemaker server?


    Member
    #139909

    Much more information is needed.

    What kind of data is being transferred?
    Where is the data? your website? Some other website?
    Your description does not make clear if the data is being brought into the database or sent out of it.
    What will cause the data to be transferred? Script? Some external trigger? user click?


    Member
    #139911

    What kind of data is being transferred?
    The data will be single record which will contain text and date fields.

    Where is the data? your website? Some other website?
    The data is in my website.

    Your description does not make clear if the data is being brought into the database or sent out of it.
    The data will be sent to the database. However, before sending the data the php script needs to check some data from the database.

    What will cause the data to be transferred? Script? Some external trigger? user click?
    It’s with a cron job in the php website.


    Member
    #139910

    First, download and read the FileMaker Server 14 Custom Web Publishing Guide..

    Then, prepare your database:

    1. Create a php user account and privilege set. Make sure that “Access via PHP Web Publishing” is checked in Extended Privileges. For best security, limit privileges to only those layouts and fields that you will access via php.
    2. For best performance, create layouts specifically designed for php. Include only the fields which php needs to access.
      Remember that the PHP API does everything from the context of a layout, not a table or TO.

    Get the FileMaker Class from Library/FileMaker Server/Web Publishing/FM_API_for_PHP_Standalone.zip. Install these files on your webpage server. The FileMaker folder must be in the same directory as FileMaker.php.

    Write your PHP script

    1. Establish a connection between the script and the database (pg 70 of the CWP Guide).
    2. Create a found set (pg 75).
    3. Retrieve the records in an array and save the fields in another array (pg 79).
    4. Perform necessary operations and calculations.
    5. If necessary, create records (pg 68).
    6. Set fields as required.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.