How to write PHP server

Joined
Feb 4, 2010
Messages
28
Reaction score
0
Hi,

I need to write small aplication that will read contents of selected
PHP script, parse it using PHP and return results. In other words I
need to write server emulation working Off-line.

My problem is that I don't know how to connect to PHP, how to use PHP
as a module in my aplication?

Should I write some kind of SAPI, if yes what should I start from?

Thanks for reply
Kamil
 
O

Obnoxious User

(e-mail address removed) skrev:
Hi,

I need to write small aplication that will read contents of selected
PHP script, parse it using PHP and return results. In other words I
need to write server emulation working Off-line.

My problem is that I don't know how to connect to PHP, how to use PHP
as a module in my aplication?

Should I write some kind of SAPI, if yes what should I start from?

Thanks for reply
Kamil

#include <cstdlib>
#include <fstream>
#include <string>
#include <ostream>

int main(int argc, char* argv[]) {

if(argc != 2) return EXIT_FAILURE;

std::string cmd("php -f ");
cmd.append(argv[1]);
cmd.append(" > phpresult");

std::system(cmd.c_str());
std::ifstream in("phpresult");
std::cout << in.rdbuf();

return EXIT_SUCCESS;
}
 
D

Default User

Hi,

I need to write small aplication that will read contents of selected
PHP script, parse it using PHP and return results. In other words I
need to write server emulation working Off-line.

comp.lang.php




Brian
 

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

Forum statistics

Threads
474,297
Messages
2,571,529
Members
48,242
Latest member
BarbMott55

Latest Threads

Top