I'm using C# to POST some data to a webserver running PHP.
I'm sending a JSON formatted object to the server in the POST data.
The data looks something like this when it leaves the C# program:
json_text={"abc":"hello", "dfg":"world"}
I have the server printing the data exactly as it received it using echo $_POST['json_text']; The script outputs the following:
{\"abc\":\"hello\", \"dfg\":\"world\"}
I'm not very familiar with how POST data is packaged into an HTTP packet. I opened up WireShark to look at how quotes are sent in POST data and it looks like they are replaced with %22. However, I tried replacing my quotes with %22 and it did NOT stop the quotes from being escaped when it is outputted.
Thank you
Turn off PHP's magic_quotes option. That's probably where the backslashes are coming from.
Setup your
json_text
object as follows, not quoting the property names and using single quotes instead:json_text = { abc : 'hello', dfg : 'world' }