C++ and PHP communication

This is a discussion on C++ and PHP communication within the Game Programming forums, part of the General Programming Boards category; I'm currently thinking about writing an online simulation game ( bunch of variables linked by formulas, all in a time-base ...

  1. #1
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209

    C++ and PHP communication

    I'm currently thinking about writing an online simulation game ( bunch of variables linked by formulas, all in a time-base ) and want it to be presented in PHP but written in C++. My question therefore is, is there a way in which PHP and C++ can directly communicate, or an indirect way better than having C++ write a file containing the game's orders, and this file being read by PHP ?

    Thanks for your time.

  2. #2
    Registered User Aalmaron's Avatar
    Join Date
    Jan 2004
    Location
    In front of a monitor
    Posts
    48
    yeah this would be interesting to know about.

  3. #3
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    yes of course they can communicate, however, I am not the man to ask on how they would do it.

    There are several ways. Some might say network programming, others might just say use simple output and input streams and redirect them, or pipe them, to the other program.

    There are several ways, but I am definitely no expert at this kind of thing, so I am not the one to give the answers.
    My Website

    "Circular logic is good because it is."

  4. #4
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    Thanks for your reply, DavidP.

    I was wondering if I could use command-line arguments to run the C++ program, have it write a file, and after a pause, the PHP would open it. However, this being on a server, I have no idea how to write a file to a directory on a webserver, but also, it would be very inefficient and slow, especially if many users wanted to access it at one time.

    Thanks.

  5. #5
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    PHP is open source afaik, so edit the code to allow for the server (having to use the modeed php) to communicate with your program, of course you have to use your own server to do this, unless you ask your host very nicely to do this.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21