Invalid Grant Type for Oauth app using PHP

Can you provide a code snippet of how you’re producing the request to I’m particularly interested in the headers are being prepared and how the body is being generated. Our application is sending Content-Type: application/x-www-form-urlencoded; charset=utf-8 and using PHP’s http_build_query function to produce the query string which should yield a body like grant_type=authorization_code&code=&redirect_uri=.