C# PHP Communication

I don’t really know how to start this thread, so I should start with the experience I have and then get to the question. Well, I’m a decent developer, still young and would like to start developing C# programs and make it communicate with PHP because there are so many more features to C# then there is to PHP and there are things that are impossible to do with PHP. Those things are the things I want to accomplish with C# and share the data with PHP.

So I ask you, where do I begin? I have a decent understanding of programming but have no experience with C#, but I do know the basics of C++ and am good with PHP. There is a place where I have to start, books, sites, articles, whatever. But it would all mean a lot to me if you could help me out here. Thanks.

There are three approaches one could take here:

  1. Expose web services and talk over HTTP – this is probably the sanest / safest / most flexibile option
  2. Use the database layer to share data, each app does it’s own thing with it. Probably reasonable for legacy stuff, I wouldn’t build something this way now.
  3. PHP5 is capable of talking directly to .NET code using the DOTNET class. Never have seen this one used in anger though.

In all honesty, you really want to do #1 in almost all normal cases.

Sorry for the late reply, but do you have any tutorial on how to talk over HTTP? Is it also possible to run it in a Linux environment, someone told me something about Mono and some sort of stuff but I’m not familiar with it and I know C# should only run on Windows.

C# can run on linux if you write it with Mono.

Communicating via HTTP is as simple as making a HTTP post to a URL with GET or POST params. Then the script on the other side should be able to handle those params. You can google HttpRequest for examples in C#, there should be loads on the internet