Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to communicate between C++ and PHP on Windows?

I've a project that has a program written in C++ (that always has to run) and a Apache web server with PHP on a Windows PC. Now I want to send parameters retrieved from clients in PHP to the C++ program and get an answer back, but I can't figure out how to do it.

I've looked at exec() and shell_exec() in PHP, but they can only execute programs, I want to call a method in C++ and send the return value back to PHP.

Is the best way to temporary store the results in a file or do you have any better ideas?

like image 656
bpn Avatar asked Sep 14 '11 10:09

bpn


1 Answers

Open a socket or use some other OS-provided interop mechanism. (I'd stick with TCP/IP sockets.)

like image 118
Lightness Races in Orbit Avatar answered Sep 21 '22 06:09

Lightness Races in Orbit