The error code seems to suggest you are failing to create a multi-part request. I would recommed not re-inventing the wheel and simply using one of our SDKs -- we support multiple languages (not PHP, however). Some of the endpoints are a little involved, and in general we've created the SDKs to make your life easier.
Thank you! Do you have any plans to make an SDK in PHP?