here is my code snippet of curl command, which I'm trying to run in eclipse:
ProcessBuilder pb = new ProcessBuilder(
"curl",
"-XPOST",
"curl https://login.xyz.com/v1/oauth/token -H \"Accept: application/json\" --data 'client_id=<clientId>' --data 'client_secret=<clientSecret>' --data 'redirect_uri=localhost' --data 'code=<code>' ");
pb.redirectErrorStream(true);
Process p = pb.start();
InputStream is = p.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String line = null;
while ((line=r.readLine()) != null) {
System.out.println(line);
}
I'm expected to get a json output, something like this:
{"data":
{
"sfEntityType":"Token",
"accessToken":<token>,
"expiryTime":<time in seconds>
},
"status":{"succeeded":true}
}
but I'm getting an output like this:
curl: (1) Protocol "curl https" not supported or disabled in libcurl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (6) Could not resolve host: application
How do I resolve this issue?