What's the best method for C# frontend to communicate with PHP/Python backend?

Hey everyone,

I’m working on a project where we need to create a C# desktop app that talks to our web apps. These web apps run on Apache and use PHP or Python. We’re doing this for internal use, so it’s a controlled environment.

The main issue I’m facing is how to handle the communication between C# and PHP/Python over HTTPS. I’m especially concerned about data conversion and serialization between these languages.

Ideally, we want to use strong typing in C# and have matching data structures on the PHP/Python side. I’ve looked into a few options like Apache Thrift and Google’s Protocol Buffers, but I’m not sure which way to go.

Our priorities are:

  1. Keeping it simple for our devs
  2. Maintaining good performance, especially on the server

Has anyone dealt with something similar? What worked for you? Any thoughts on using XMLRPC or SOAP for this?

Thanks for any advice!

hey there! have you considerd using GraphQL? it’s pretty cool for strong typing and flexible queries. plus, it works great with c# and php/python.

what kind of data are you dealing with? maybe we could brainstorm some ideas based on your specific needs?

whats your experience with API development so far?

have u tried using restful apis with json? its pretty simple to set up and works well with c# and php/python. plus, its easy for devs to understand.

for performance, you could look into protocol buffers. theyre faster than json for big data transfers.

whats ur data size like? that could help decide which way to go.

From my experience, gRPC could be an excellent solution for your situation. It’s designed for high-performance, low-latency communication between services and supports strong typing across different languages.

gRPC uses Protocol Buffers for serialization, which is more efficient than JSON for large data transfers. It’s well-supported in C#, PHP, and Python, making it ideal for your tech stack.

The learning curve is steeper than REST, but the benefits in performance and type safety are significant. It also supports bi-directional streaming, which could be useful for real-time updates.

For internal use, gRPC’s HTTP/2-based transport is perfect. It’s secure, fast, and works well in controlled environments. Plus, the code generation features can save development time in the long run.

Have you considered any streaming requirements for your application? That could influence your choice as well.