Reputation: 3496
I can find a lot of information on running C++ programs from PHP, but not the other way around. I want to run a PHP script from C++, which will perform some calculations and then use "echo" for output. The C++ program should wait to receive the output from the PHP script and parse it before continuing.
Thanks!
Upvotes: 2
Views: 1174
Reputation:
You could utilize a pipe and run 'php script.php'. An annoying example for a pipe in windows (full of boilerplate) is at http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499%28v=vs.85%29.aspx
Upvotes: 1
Reputation: 193
Try this
#include <cstdlib>
int main(){
system("php file.php");
return 0;
}
Upvotes: 2