title: best practice for c# calling php which then queries the database
body: <p>For some reason I have to have a windows client application (written in C#) which communicates with the PHP files that are on my server. Windows application can't be allowed to have SQL queries in the code because of the possible disassembling of the exe file. This is the main reason why this approach is used. </p>
  
  <p>Basically it looks like this: from windows client i call getResult.php which then opens the connection to the database, queries the database, returns the result to the client and closes the database connection. Therefore windows client doesn't have any code for querying the database, it just has calls to the PHP file.  </p>
  
  <p>My several questions follow:<br>
  1. What is the best way to send request from c# code to the PHP file? (Cause I need to send this php file some parameters like ID, etc... -> I know I can do it with GET like this getResult.php?id=123456, but is this same possible with POST? And also, one question: how to do this in code? http requests or?)  </p>
  
  <p>2.Since every time I call the PHP file (there will be more files which I will call, like getResult.php, getStatus.php, etc...) I will somehow need to send login information to that PHP file with which that PHP will query the database. My question here is how to do this securely, and plus: is it maybe somehow possible to call something like doLogin.php and send the login username and password one time, and after that call this (and all other) php files without the need to send the login information as a parameter to the function. I know I can use PHP sessions when the whole application is on the server, but the main difference here is that I am only calling some files, executing them and closing the connection.  </p>
  
  <p>My main question is: is this ok from conceptual point of view or are there any commonly known concepts for this, for which I don't know about - please advise I'm willing to learn. I did some research and do believe this might have to be done with web services approach, but please do reply your thoughts on this. </p>
  
  <p>Thank you for your help!</p>