C++ with php

Hello.

I have created a application in c++, that returns content from text files with different data types.

Now I wonder… How can i write a function in php that connects to my application in c++, and then tell the application to retrive certain content, and lastly returns the content (in their right datatypes) back in to an array in php?

Any suggestions?

http://php.net/manual/en/ref.exec.php

Thanks, but how can this be done if the c++ program/application is running on another computer/server, different from the webapplication/php. Maybe I can connect to it with a ip and password somehow?

you could connect to the server using ssh, although it generally makes more sense to have the C++ application offer a public interface (Web Service, SOAP, etc.).

1 Like

Thank you, I’ll take a closer look at what you’ve mentioned. But how about mysqli_connect and mysqli_query functions. How do you think they work internally? They fulfill the same function I’m trying to achieve

you could check the PHP source code …

There a C application (PHP) communicates with another C application (MySQL) via TCP using MySQL’s public interface.

https://dev.mysql.com/doc/refman/8.0/en/c-api-implementations.html

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.