Run php from c++

T

Tony B

I'm looking for some ideas on how to make a c++ program to execute a php
file and receive the output from the php script into the c++ program for
processing within the c++ program ?
Thanks
Tony
 
V

Victor Bazarov

Tony said:
I'm looking for some ideas on how to make a c++ program to execute a
php file and receive the output from the php script into the c++
program for processing within the c++ program ?

Is that a question.

C++ language does not define "php script" or "php file". There is
nothing in the language itself that tells us how to "execute" them.
You most likely need to post your question (or statement, I haven't
figured it out yet) in a newsgroup that deals with PHP or your OS.

Running another program is only possible in standard C++ through
the function 'system'. Obtaining any output of that is not possible
at all, unless some OS-specific mechanisms are employed, like pipes.
But that's all off-topic in a language newsgroup, sorry.

V
 
G

Gernot Frisch

Is that a question.

C++ language does not define "php script" or "php file". There is
nothing in the language itself that tells us how to "execute" them.
You most likely need to post your question (or statement, I haven't
figured it out yet) in a newsgroup that deals with PHP or your OS.

Running another program is only possible in standard C++ through
the function 'system'. Obtaining any output of that is not possible
at all, unless some OS-specific mechanisms are employed, like pipes.
But that's all off-topic in a language newsgroup, sorry.

Then again, for such a problem - which NG would fit?

Well, PHP is open source, so it should be possible to build, link and
use it.
 
V

Victor Bazarov

Gernot said:
I'm looking for some ideas on how to make a c++ program to execute
a
php file and receive the output from the php script into the c++
program for processing within the c++ program ?
[..]

Then again, for such a problem - which NG would fit?

Not this one. Since (AFAIK) PHP is mostly used to produce HTML pages
to be viewed in a browser, 'comp.infosystems.www.authoring.cgi' might
be a good start.
Well, PHP is open source, so it should be possible to build, link and
use it.

You mean, build it into the same program, right? If that's what the
OP wants and is able to do, sure. I still don't see a C++ language
question here.

V
 
I

Ian Collins

Gernot said:
Then again, for such a problem - which NG would fit?
One for the OP's OS. Most if not all hosted environments have a means
of running a child application and reading its output (for example popen
in UNIX), but the details are OS specific.
 
D

Diego Martins

One for the OP's OS. Most if not all hosted environments have a means
of running a child application and reading its output (for example popen
in UNIX), but the details are OS specific.

Ian is right. You can run externally the PHPBIN interpreter and
collect the output.

A pertinent question raises here: is there a usenet group that deals
with C++ non-portable issues?
(e.g.: the OP and me could ask: "what is the popen() equivalent in VC+
+?")

Diego
 
I

Ian Collins

Diego said:
Ian is right. You can run externally the PHPBIN interpreter and
collect the output.

A pertinent question raises here: is there a usenet group that deals
with C++ non-portable issues?
(e.g.: the OP and me could ask: "what is the popen() equivalent in VC+
+?")
Ask in a VC group, just explain what popen() does.

I've often seen "what's the Solaris equivalent of xxx" without any
explanation what xxx does on Solaris lists.
 
D

Diego Martins

Ask in a VC group, just explain what popen() does.

I've often seen "what's the Solaris equivalent of xxx" without any
explanation what xxx does on Solaris lists.

I hope I am not asking too much, but do you know what are the best
usenet groups talking about C++ in linux, solaris and windows?

Diego
 
I

Ian Collins

Diego said:
*Please trim signatures.*

I hope I am not asking too much, but do you know what are the best
usenet groups talking about C++ in linux, solaris and windows?
comp.unix.programmer for the first two, no clue about the last.
 
V

Victor Bazarov

Ian said:
comp.unix.programmer for the first two, no clue about the last.

I am puzzled by the question, though. There are three orthogonal
aspects of C++ on {whatever}. It's either C++ as a language, and
then c.l.c++ is the right place. Or it's a particular C++ compiler,
and then it's the compiler-specific newsgroup (like m.p.v.l). Or
it is programming the OS using that language, and then language is
immaterial in most cases and you need the OS newsgroup (for Windows
there are several, like comp.os.ms-windows.programmer.*).

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top