Actr_StartHTTPServer (function reference)

Activator Plug-in > Functions reference > Actr_StartHTTPServer
Activator Plug-in for FileMaker Pro

Actr_StartHTTPServer

Starts the built-in HTTP Server. This web server will trigger a script when data arrives.

SyntaxFunction badge

Actr_StartHTTPServer ( switches ; fileName ; scriptName ; {password} )

Parameters

switchesdetermine the behavior of this command
filenamethe name of the file which contains the script to trigger when a HTTP request arrives
scriptnamespecifies the name of the script to trigger when a HTTP request arrives
password(optional) a password which the sender needs to add to the HTTP request

Switches

switches must contain only one of this:

-Defaultportnumberuse the default port number of the Activator (TCP port 54242)
-Portnumber=xxxuse the specified portnumber xxx

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0no error
$$-50paramErrthere was an error with a parameter

Other errors may be returned.

Originated in

Activator Plug-in 3.0

Compatibility

FileMaker Pro 12 to 16

Considerations

This functionality is currently only available on Mac OS.

Only HTTP requests which are posted to the right web page will trigger the script. Other requests (for example for the index.html page) are ignored by the plug-in. You can now also send text only to the plug-in.

The plug-in will make the HTTP server known via Bonjour as “Troi Activator Upload Server”, allowing for easy discovery.
See the UploadData.fmp12 example file for more detailed information.

Example

Set Field [ result ; Actr_StartHTTPServer ( "-Unused" ; "Upload.fmp12" ; 
				"HTTP_TriggerScript" ; "secret" ) ]

This command starts the HTTP Server. When (image) data comes in it will trigger the script “HTTP_TriggerScript” in file “Upload.fmp12”. Note that this example is somewhat simplified, normally you should not use a hardcoded filename like in the above example.

Example 2

Add the following script steps:

Set Variable [ $password ; "secret" ) ]
Set Variable [ result ; Actr_StartHTTPServer ( "-Portnumber=12345" ; Get ( FileName ) ; 
				"HTTP_TriggerScript" ; $password ) ]

This command will start the HTTP Server, with the HTTP Server listening on port 12345. Users can now send images or text data from other computers or for example an iPhone or iPad.

Related functionsFunction badge

Actr_GetEventInfo
Actr_StopHTTPServer

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 12 to 16 –> Actr_StartHTTPServer (actrp4621) 2017-0823 11:21:25