Jump to content

Basic PHP/FM Interaction


This topic is 7334 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Here is a php script which accepts CDML URL arguments and passes them to FM.


<?php

if ($_SERVER["QUERY_STRING"] != "")

   {

   include("http://10.0.1.107:591/FMPro?" . $_SERVER["QUERY_STRING"]);

   }

else

   {

   echo "POST method is not yet implemented";

   };

?>

This can be called by a URL like this:

http://mywebserver/fmpro?-db=mydb.fp5&-format=mypage.html&-findall

The line:

include("http://10.0.1.107:591/FMPro?" . $_SERVER["QUERY_STRING"]);

is talking to FM on a LAN. It could also be on the same host with:

include("http://localhost:591/FMPro?" . $_SERVER["QUERY_STRING"]);

This part:

" . $_SERVER["QUERY_STRING"]

adds the agument list to the new URL.

Hope this is of interest.

Garry

Link to comment
Share on other sites

Here is a version of the "PHP Filter" which processes Forms:

 <?php

if ($_SERVER["QUERY_STRING"] != "")

	{

	@include("http://localhost:591/FMPro?" . $_SERVER["QUERY_STRING"]);

	}

else

	{

	$args = "";



	while ($fm_params = Current($_REQUEST))

		{

		$args .= urlencode(key($_REQUEST)) . "=" . urlencode($fm_params) . "&";

		next($_REQUEST);

		};

		

	@include("http://localhost:591/FMPro?" . $args);



	};

?> 


You could use a Form like this:


 <body>

Hello World<br>

<form action="fmpro.php" method="POST">

<input type="hidden" name="-db" value="combotest.fp5">

<input type="hidden" name="-format" value="-fmp_xml">

<input type="submit" name="-new" value="New Rec">

</form></body> 

Good Luck.

Garry

Link to comment
Share on other sites

This topic is 7334 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.