Thanks for the notice on
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($contents))
);
It seems that was the issue I was fighting. My server was giving error code 400 malformed for a while before switching that in.