1

Possible Duplicate:
Can PHP and C++ pass data between each other?

I want to pass some parameters from C++ to PHP, though I don't know what to use. Will $_POST and $_GET suffice or are there better options for these kind of connections?

The PHP is just a simple "data to OpenOffice document" script. This script needs to receive some parameters from a C++ application and collect data according to those parameters from a MySQL database.

EDIT:

Found the answer, I could achieve what I wanted simply through URL-passing

Community
  • 1
  • 1
Resitive
  • 280
  • 1
  • 6
  • 24
  • 1
    This depends on what you need. In certain situation just accessing the URL would be enough, but if you want more complex functionality (like a web service in php that allows you to add/edit/delete entries, and grab complex information), you should consider REST or SOAP. – Vlad Preda Jan 29 '13 at 12:08
  • 1
    Please be more specific: What are "these kind of connections"? Are both applications running on the same machine? Is the target a CLI PHP script, a web application, a web service? – Fabian Schmengler Jan 29 '13 at 12:10
  • 1
    This is not a duplicate of question #9936280. Question #9936280 deals with initiating data transfer in PHP, this question deals with initiating data transfer in C++. Note that *duplicate* means *This question has been asked before* and not *The answer is similar to a question asked before*. – Oswald Feb 01 '13 at 10:55
  • @Resitive Do not provide an answer by editing your question. Add a proper answer like I and user1929959 did. Also, if your PHP script is available as a web application (i.e. it has a URL), you should have mentioned it in the question. – Oswald Feb 01 '13 at 10:57

2 Answers2

2

Use system() to start the php intepreter, passing the name of the script and any additional arguments as part of the command parameter. You can then access the arguments passed to the script using the $argv variable.

Oswald
  • 31,254
  • 3
  • 43
  • 68
0

Aside from similar questions, take a look on executing a C++ application over the internet with PHP.

Mihai8
  • 3,113
  • 1
  • 21
  • 31