2 Replies Latest reply on Nov 3, 2014 10:40 AM by njem

    filemaker.php goes on web host?

    njem

      A PHP beginner question. I have a hosting company hosting my FM db, because it's a web-public fundraising site. I have another hosting company, yahoo, hosting my website. I need a simple PHP page to receive a url parameter and use the api to write it into into a record in the db, then jump to the webdirect FM page. I've figured out enough PHP to do it. But something I'm fuzzy on. If I have the concepts right it would be yahoo that has to have the filemaker.php in their system to allow the php page to use the api calls. Do I have that right? I'll ask yahoo but has anybody else done this with big hosting companies like that? Or do I have to buy a little web hosting service too from the company that's hosting the FM so it's a company that will have the api available in their web hosting?

       

      Thanks

        • 1. Re: filemaker.php goes on web host?
          Mike_Mitchell

          filemaker.php (and its associated files) needs to be in the include path for the PHP install on the web server. By default, that would be wherever the PHP page is being hosted.

           

          One way you can be certain of this is to place a copy of the API in your includes\ directory along with the rest of your PHP include files and simply reference it there.

           

          So the short answer is yes, you can place it on the Yahoo site and everything should work fine.

           

          Mike

           

          P.S. It's worth noting that you may end up with some performance issues, since your web server and FileMaker server are not in the same building. That means requests to the database have to travel over a WAN, which will introduce significant latency. Most hosting services for FileMaker include web hosting with their FileMaker offerings at no additional charge.

          • 2. Re: filemaker.php goes on web host?
            njem

            Thanks. I got the php api stuff in my website and it's running. Didn't realize I could put it in my own website files.

             

            I knew there would be a delay because web hosting and FM hosting are in different places but I think it's worse than that. Most of the time the code works (see below). Sometimes it just spins and I guess times out and I get an "error 500 internal server error" which seems to be generated by the web host. Unreliable. I think I will have to move at least this page to the FM hosting company. When it fails like that I get no info from the isError call, and just echoing $result seems to always equal "Object", whatever that means.

             

            <?php

               require_once ('FileMaker.php');

               $connection =& new FileMaker('filename', 'http://ip address');

               $connection->setProperty('username', 'name');

               $connection->setProperty('password', 'pwd');

               $cmd = $connection->newAddCommand('layout');

               $cmd->setField('field', "test data" );

               $result = $cmd->execute();

               echo $result;

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

                  echo 'error is: ' . $result->message . '(' . $result->code . ')';

                  }

            ?>