If that works where your former script didn’t that would suggest you have different versions of PHP on local and live
And thus different php.ini and different defaults.
Rather than sending trash in the POSTFIELDS you could send the whole payload
Or declare a header to declare what content type you are sending.
So a
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
Might solve your issue.