I am making a PHP webpage that will retrieve data from a database and allow a user to send that data as an object to a database utilized by another application. Because of the API of the application, the object I need to send it as requires .NET.
The C# page takes in the necessary constructors, creates the object, and sends it. This part of my code functions perfectly when run within Visual Studio or when ran as a .exe from the command line. I can, presumably, run exec() on the executable and have it run that way within my PHP page.
However, I am hesitant to develop it this way. It seems like there should be a way to simply have a/some PHP file(s) within the same project and call the C# file directly.
I am very new to both PHP and C#. I have searched for both solutions, and I have only found that it is possible to run an executable that uses C# within PHP and seen examples of C# using PHP, but nothing that addresses using an executable over referencing the file directly, or even anything about just referencing a C# file within a Visual Studio project.
To clarify the question, I am wondering if it is possible to execute code from a C# file directly with PHP, and if so, is it a better practice than using exec() to run an executable version of the C# project.
EDIT: I want to clarify that I know PHP isn't naturally available within Visual Studio.