[英]Converting CURL request to HTTP Request Java by method GET
我有以下 CURL 請求任何人都可以確認我接下來的 HTTP 請求是什么:
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。
你應該看看這篇文章: Using java.net.URLConnection to fire and handle HTTP requests
您應該能夠按原樣傳遞數據部分:
URLConnection connection = new URL(url + "?" + dataString).openConnection();
使用:
connection.setRequestProperty("Accept: application/json", charset);
添加標題
這是一個起點...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.