• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

passing data from c++ to php

  well, i wrote a program in c++. from the program, i open a web site written in php. then i pass data to it, and populate some fields in a form on the site. the only say i can figure out how to do it is by creating a long string, first with the web site name, then a "?", and then append the data i want to pass. the problems are: 1. the person can see all the data in the address bar at the top, and 2. they can change the data by just changing the address bar and refreshing. i need a way to do it that either encrypts or hides the info in the address bar, or to pass the info another way besides that big long string. for those of you that know c++, i am using "shell execute" to open the web site from my program. i need help.

  • 2
3 Solutions
It's not possible to hide the data from the address bar. What you could do is to have a form which automatically submits the data to a new page with the post method.

url: http://domain.com/yourPage.php

in yourPage.php

<form action="finalPage.php" method="post">
<input type="text" name="inputValue1" value="<? echo $_GET['inputValue1']; ?>">
<input type="text" name="inputValue2" value="<? echo $_GET['inputValue2']; ?>">
<input type="text" name="inputValue3" value="<? echo $_GET['inputValue3']; ?>">
<script type="text/javascript">

Then pick it up the $_POST variables at finalPage.php

In yourPage.php you could have this body tag to prevent users from navigating back to it:

<body onload="history.forward()">
The point is..

The variable would in the address bar at yourPage.php, but they would be posted to finalPage.php right away and in finalPage.php you won't see them.

Shell Execute is a bad way to do this really.


Maybe that can provide some help?
Marcus BointonCommented:
This is not a PHP question at all - it's how to do an HTTP POST in C++. If you're happy using shell_exec, you should perhaps look at using CURL to do the request for you, or alternatively, link the CURL library in with your app. A library specifically for helping with doing that can be found here:


Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now