[英]HTTP POST using CURL in Linux
Help needed on finding corresponding curl command syntax corresponding to below java code which works. 查找与以下Java代码相对应的相应curl命令语法所需的帮助。
Working Java Code> 工作的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);
Corresponding Curl Syntax needed? 需要相应的Curl语法吗? Please help on corresponding syntax for curl 请帮助卷曲的相应语法
Thanks in advance. 提前致谢。
General curl command worked. 常规curl命令起作用。 I missed specifying the URI while calling targetURL. 我错过了在调用targetURL时指定URI的过程。
Working Command Syntax 工作命令语法
curl -vX POST -H "Content-Type: text/xml" -H "Authorization: Basic U1ZDLlNPTFJPRTE6anVXMmFfdVc=" -d 'command' http://targethost.com/URI 卷曲-vx POST -H “内容类型:文本/ XML” -H “授权:基本U1ZDLlNPTFJPRTE6anVXMmFfdVc =” -d '命令' http://targethost.com/URI
Thanks. 谢谢。
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.