Run a PHP script from within Server Connect

Following on from this thread:

Could we have a Server Connect action which will run a PHP script locally (ie. not using a full URL) so we can keep it secure?

Basically, having an action that’s very similar to the API action but simply putting in the local path to it so we can also share variables with it.

It is already possible to build custom actions and formatters in which you can run your custom code.

Thanks @patrick. Could we not have a server action which works like the API Action letting us just select a PHP file and it then runs/includes it? For example, have a Condition action which, when something is true, run mycustomscript.php.

This would be way simpler and stays in the realms of non-coding (I know the script itself is hand coded but you know what I mean).

What does such a php file contain and how does it return data, should the action call a specific function in it or does it have to capture the response from that php file.

Where I’ve needed this is in creating a dynamic PDF. I’ve put a PHP script into the folder and put in my own hand-coded database connection and coded from there. I used an API Action to call it and sent an ID in the URL. I checked the $_SESSION variable for the logged in user ID so it couldn’t be run by anyone else but doing it via a direct path rather than a URL will make it more secure and way better.

Does that make sense?

Isn’t the issue simply that it would be helpful to be able to select a file here, as an alternative to a URL:
image

?

4 Likes

You put it so much better than me, @TomD. :+1:

1 Like

@patrick,

What ever came of this request?

It is possible to write your own actions for server connect, that way you can run your own code.