Passing Parameters to FileMaker WebDirect

I’ll admit, pushing parameters to FileMaker WebDirect sessions has not been high on my priority list.

Actually, it hasn’t made the list at all, so far.  Thankfully, guys like Mike Duncan, Mike Beargie, and Steve Senft-Herrera are on the case.  FileMaker removed the ability to pass parameters to WebDirect in the 13.0v2 update, and these enterprising fellows found a way to add it back and keep it secure:

FileMaker WebDirect represents the next step in FileMaker’s WYSIWIG web publishing strategy. It was introduced as part of the FileMaker 13 platform and runs as a feature of FileMaker Server.

As of the FileMaker Server 13.0v2 update, the ability to pass in parameters via a URL has been removed due to unspecified security concerns. Despite this omission, it seems a reasonable expectation to be able to pass parameters to a web app in order to do something. Some have referred to this functionality as “Deep Linking.”

In the example presented here, we demonstrate how to bring this ability back to WebDirect. It involves a few PHP files to make it work, along with a startup script in your FileMaker file to check for the existence of any parameters. There are no Plug-ins required, or the need for Custom Web Publishing… only WebDirect and some PHP.

The solution (download available at the link below) includes setting up three php files and modifying some scripts, but is useful for those time when passing parameters is a must:

The Recipe

To be able to pass in parameters to a WebDirect session, we will utilize just a few external PHP. There are several ways to go about this, and differing approaches may suit your particular use case. For this example, we will highlight a more general approach that provides a great amount of flexibility. This script will also allow us to pass in as many parameters as you need to.

Here’s how it works, in only three steps:

  1. The initial page, “fm_link.php” will set all the passed parameters into a session variable.
  2. Next, a web viewer will set the session variable to a temp file on the server using the next PHP page, “fm_write.php” using a key assigned by FM, and destroy the session in PHP.
  3. Finally, an Insert from URL will access the temp file and convert the returned parameters as local variables in FM, then perform a find with some of the parameters that were passed.

With three fairly simple PHP scripts, we will store all parameters in the URL string as key-value pairs. An example of this might be:

http://my_server.com/fm_link.php?key=value&key2=value2

This solution is for advanced developers or those with some php experience.  But it’s also a great way for intermediate users to learn more about php and FileMaker.

via Extending WebDirect: URL Parameters.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help