PHP_Execute
PHP_Execute ( phpCode {; keepMemory {; timeoutSeconds }} )
Description
Allows you to execute PHP code and get the results.
Parameters
phpCode
(required)
The PHP code to execute.
keepMemory
(optional)
Used to indicate that values of the PHP code execution in memory should be kept from the previous execution.
timeoutSeconds
(optional)
The number of seconds to wait for execution to complete. The default timeout is 60 seconds but this can be changed using PHP_Timeout.
Return
Returns the result of the PHP code.
Errors
201 Timeout
202 PHP error
203 User cancelled
204 FileMaker error
Example 1 - Hello world!
PHP_Execute ( "echo 'Hello world!';" ) /* Returns: Hello world! */
Example 2 - Timeout
PHP_Execute ( "sleep( 2 ); echo 'timeout';" ; 0 ; 1 ) // Sleep for 2 seconds but timeout after 1 second /* Returns: 201 Timeout */
Example 3 - List documents folder
PHP_Execute ( "print_r(implode(chr(13), scandir(FM_DOCUMENTS_PATH)));" ) /* Returns: Directory listing of your documents folder */
Example 4 - Google search result
PHP_Execute ( "echo file_get_contents('http://www.google.com/#q=FileMaker');" ) /* Returns: Google search results for 'FileMaker' */