 <p>To better understand the differences between the PHP code and cURL, I created a RequestBin instance and tried both on it. They yielded drastically different results:</p> <p><img src="https://i.stack.imgur.com/py40h.png" alt="RequestBin"></p> <p>It seemed like the POST data from the PHP script yielded an incorrect result for what was sent. This can be fixed by using a built-in PHP function <a href="http://php.net/http_build_query" rel="nofollow noreferrer">http_build_query</a>.</p> <p>It will yield a more apt result:</p> <p><img src="https://i.stack.imgur.com/XnCHf.png" alt="RequestBin with fixed problem"></p>