Answer the question
In order to leave comments, you need to log in
What approach should I use to communicate between a C# application and a PHP server?
There is an application written in PHP, and there is also additional C# helper software for specific tasks that interacts with the PHP application. C# software is planned to be used automatically through the task scheduler, i.e. use by a normal user is not provided (with the exception of a system administrator)
The essence of the question is what approach for the interaction of these two applications in this case is more competent to apply?
Personally, I hesitate between the following:
Option 1 - Implement methods in PHP for working through the command line (CLI), in a C # application, execute the necessary command line commands (call a php script) and then get the result of the work.
Option 2- Implement a PHP REST API server, and in a C# application send a request to the server with the necessary commands and then get the desired result.
Sorry if I clumsily explained, I hope for your help)
Answer the question
In order to leave comments, you need to log in
I don't quite understand the architecture where option 1 is possible - does that mean PHP and C# are both on the server? If you mean that you will write console commands that will run on the client, then definitely not worth it, choose option 2. Because, judging by C#, the client application is most likely installed on Windows, and it is very unnecessary to install the PHP interpreter along with the client application.
Well, besides, the REST API is an old, good, proven method of communication, and running console commands with reading their output or with side effects looks like a crutch, it would take place if it is some kind of system utility from a third-party developer, which is simply use from terminal and difficult to use as SDK.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question