I dont understand or fail to cURL to postUrl

I dont understand or fail to cURL to postUrl

Hi,


I have this [PayPal] example of cURL:

curl https://api.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" \ -d "grant_type=client_credentials"
I want to use postUrl and did the following:

  1. headersMap = map();
  2. headersMap.put("Accept-Language", "en_US");
  3. headersMap.put("Accept", "application/json");
  4. detailsString = "grant_type=client_credentials";
  5. responseMap = postUrl("https://EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp@api.sandbox.paypal.com/v1/oauth2/token", detailsString, headersMap,false);
  6. alert(responseMap);

and other variations that all fail with as similar to this:


{"responseCode":"415","responseText":"HTTP Error"}
 






Any help is blessed :)


Cheers,