The error is just confusing, the key thing is the 303 response code. That is a redirect. Where is the redirect going? It does not say, but I bet you are being redirected to .../login/index.php. (Line 86 of processattemp.php.)
So, in order to make the POST request work, you need to find a way to establish a Moodle session for the user on whose behalf you are submittin answers.
Now, as I said, the transaction error is not relevant, but just to explain it. We start a transaction on line 48 of processattemp.php, before the call to require login. Now, either that is a bug in my code, if you are not supposed to do that; or it is a bug in require_login() or redirec(), if they are incorrectly assuming that a transaction has not been started.
I will have to ask some other Moodle developers which bit of code needs to be fixed there.