Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing data from C++ to PHP

Tags:

c++

php

passthru

I need to pass a value from PHP to C++. I think I can do with PHP's passthru() function. Then I want C++ to do something to that value and return the result to PHP. This is the bit I can't work out, does anyone know how to pass data from C++ to PHP? I'd rather not use an intermediate file as I am thinking this will slow things down.

like image 686
Columbo Avatar asked Mar 01 '23 15:03

Columbo


1 Answers

You could have your c++ app send its output to stdout, then call it from PHP with backticks, e.g.

$output=`myapp $myinputparams`;
like image 145
Paul Dixon Avatar answered Mar 12 '23 22:03

Paul Dixon