As the title of the topic may suggest, I have a PHP script setup on my server that, when called upon, is spitting data back to the user by echoing it back onto the page. I am then using HttpWebRequest
to read the data that was put onto the page by the PHP script. While this data is encrypted, I would like for it to not appear on the page at all. I figured there must be a better way to go about doing this.
If I have been unclear thus far regarding my intentions, I am looking for some way to return data from a PHP page, so that I can retrieve it using HTTPWebResponse
. Perhaps, for example, I could POST the data? I'm quite new to PHP so I figured I'd ask the experts here.
Thank you for any help,
Evan
I think the best safe way is use RSA Encrypt in .NET. You can read and download project at here
You can't post the data to the application, unless the application was a webserver. There's not really much other way to do it than the way you are doing it already.
Well, Since you're using http, it's logical to echo the data in the request stream within your php script. This way the other side (your .NET code can pick it up). If this is a problem for you, there are a few workarounds.
a: call your PHP script from .NET with a callback url refering back to your .NET application. Now the PHP script can actually post data back to the callback url. This however requires your .NET app to host a webservice.
b: you can put certain data in your php script without actually putting it in the request body by making it a mime header field like:
header('X-MyProject-Name: ' .$name);
header('X-MyProject-Age: ' .$age);
header('X-MyProject-Address: ' base64_encode(json_encode($complexAddressObject)));
Hope this helps