0
curl -d 'user[name]=huck&user[email][email protected]''http://sandbox.v2.xyz.com/api/berl/a4be95e6f86/users.json'
誰能告訴我我們將如何運行這個curl命令。Java相當於Curl
另一件事,如果我運行它通過Java什麼將是這個呼叫的Java相當於? 它基本上是休息服務
curl -d 'user[name]=huck&user[email][email protected]''http://sandbox.v2.xyz.com/api/berl/a4be95e6f86/users.json'
誰能告訴我我們將如何運行這個curl命令。Java相當於Curl
另一件事,如果我運行它通過Java什麼將是這個呼叫的Java相當於? 它基本上是休息服務
呼叫您有兩個choiches:
使用像HttpClient。
使用類似apache exec
如果是REST調用,可能是HttpURLConnection的API將helpful.http://digiassn.blogspot.com/2008/10/java-simple-httpurlconnection-example .html – kosa 2012-08-01 13:56:24
與http://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java非常相似 - 你想發送一個HTTP請求並讀取響應。 – ametren 2012-08-01 13:57:58
甚至更好:http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests – ametren 2012-08-01 13:59:09