it's often difficult to guess why something occurs without being able to test using a poster's code and endpoint(s).
but i do have some questions:
in okhttputils2, why do you only test for success? in the event of failure, you would never
know if the request had failed or why. in addition, there are a number of properties available
in okhttputils2's response object. you might want to check them for any hints as to
what is happening on the response side.
in php, you've enabled error reporting; are you reporting them somewhere? are
errors (if any) being returned to okhttputils2? if not, can you make that happen?
echo "fail" is not helpful. i'm not seeing any display_errors command. are there
any errors? what do you see in okhttputils2's getstring method?
in php, i assume $_FILES['file']['name'] refers to the uploaded file (file=name).
what, then, is $_FILES['file']['tmp_name'] ?
a comment: unless you know for a fact that http and https are handled by the same server,
it is possible that they are not. there is no requirement that a server listening on port
80 be the same as a server listening on port 443.