PHP for C / C ++ via CGI script

I understand that this may be something strange, but that’s what I have.

I have an application (handwriting recognition engine) written in C / C ++. This application has a Perl shell, which was made by application authors using SWIG . My site is written in PHP, so I'm looking for some ways to get PHP to work with a C / C ++ application.

The only way I can think now is to create a CGI script (perl script) that accepts a POST request from my site (AJAX request), sends it to the recognition engine through the Perl shell, receives the required data and returns the required data to response to an AJAX request.

Do you think this can be done like this? Are there any better solutions?

Thank!

+3
source share
2 answers

Do you think this can be done like this?

Yes, there are no reasons why this is not possible.

Are there any better solutions?

May be. If you intend to execute the perl shell as a system call of a separate Perl script, you do not need a separate CGI perl script. You can simply make system calls with PHP directly on your site. Not a big difference, but it can help if PHP is more for your comfort zone for web content than Perl CGI

OTOH, Perl script API, Perl CGI, Perl script Perl CGI script API , .

, - Win Win, .

+2

:

web client <-> Perl CGI script <-> Perl wrapper <-> C program

, . ? , , .

, Perl:

web client <-> Perl CGI script <-> C program

, ? Perl .

, , - , , Perl . .

+2

Source: https://habr.com/ru/post/1739923/


All Articles