2016-04-19 29 views
-1

我有以下的捲曲請求任何人都可以跟我確認這將是後續的HTTP請求:轉換CURL請求HTTP請求的Java通過GET方法,

curl -i -L -H "Accept: application/json" --data "client_id=APP-UJA2FDFLIVK14WMW&client_secret=6d8d32f1-1c25-4356-8b15-4d803d9a869e&grant_type=authorization_code&code=dj4kYk&redirect_uri=https://developers.google.com/oauthplayground" "https://api.sandbox.orcid.org/oauth/token" 

任何人都可以是一種足以幫助我轉換成以上curl請求完全到httpreq。

+2

你應該先嚐試一下,如果你卡住了,請發表你的問題。 – Abhishek

回答

0

,你應該看看這篇文章:Using java.net.URLConnection to fire and handle HTTP requests

你應該能夠通過數據部分的是:

URLConnection connection = new URL(url + "?" + dataString).openConnection(); 

使用:

connection.setRequestProperty("Accept: application/json", charset); 

添加頁眉

這是一個起點...