I suspect that what this is doing and what you think it is doing are two different things, and further that the Content-Type header doesn’t match this clause.

Review PHP: curl_setopt - Manual