簡體   English   中英

在Linux中使用CURL的HTTP POST

[英]HTTP POST using CURL in Linux

查找與以下Java代碼相對應的相應curl命令語法所需的幫助。

工作的Java代碼>

    HttpPost httppost = new HttpPost("/SEMP");
    httppost.addHeader("Authorization", "Basic U1ZDLlNPTFJPRTE6anVXMmFfdVc=");

    StringEntity stringEntity = new StringEntity("<rpc>command</rcp>", "UTF-8"); stringEntity.setContentType("text/xml");
    httppost.setEntity((HttpEntity)stringEntity);

    CloseableHttpResponse response = httpclient.execute(targetHost, (HttpRequest)httppost, localcontext);

需要相應的Curl語法嗎? 請幫助卷曲的相應語法

提前致謝。

檢查curl手冊頁。 特別是-u節。

常規curl命令起作用。 我錯過了在調用targetURL時指定URI的過程。

工作命令語法

卷曲-vx POST -H “內容類型:文本/ XML” -H “授權:基本U1ZDLlNPTFJPRTE6anVXMmFfdVc =” -d '命令' http://targethost.com/URI

謝謝。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM