When I try the following:
$post_string='data='.urlencode(json_encode($data)); //data is a big nested array
$post_string='&password='.urlencode($password);
$post_string='&username='.urlencode($username);
The $_POST data I received on the other server becomes corrupted – either password or username is missing. I suspect I did not encode the data into JSON in the correct way. What have I done wrong?
You are using
=to assign a new value. Each line discards the previous value. You want to use.=for a concatenating assignment.