outgoing curl problem

Re: outgoing curl problem

by Benjamin Ellis -
Number of replies: 2
Picture of Particularly helpful Moodlers
Hi,

Send the request to a script that displays the request params and maybe even the headers, so you can see exactly what is being sent. BTW maybe declaring 'CURLOPT_POSTFIELDS' => $params in setopt() method may be clashing with the params being passed into the post() method.
In reply to Benjamin Ellis

Re: outgoing curl problem

by Benjamin Wolf -
The double post fields resulted in my testings, but did not influence the test. But thanks for the tip for debuggin. With that i was able to track this down.
The other side cloud not debug how the call reaches them. But i simply make my own target file as you suggested.

The problem was the http_build_query function. After including the moodle config it uses & instead of & as argument separator. With this on the target side the parameter appear as amp;grant_type. When i build the query manuall with the &, the call works as suspected.

Thanks for the debugging hint.
In reply to Benjamin Wolf

Re: outgoing curl problem

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Yep, that has happened to me before, I think I used html_entity_decode() to reverse it. No problem about the hint.