使用HTTPie使用XML有效负载进行POST调用

时间:2019-03-11 03:40:45

标签: xml http curl payload httpie

是否有等效的方法可以通过HTTPie进行此cURL调用?

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="form-group"> <div class="form-row"> <div class="col-md-4"> <label for="inputJammulai">Start</label> <!-- <div class="form-label-group"> --> <input type="time" name="inputJammulai" id="inputJammulai" class="form-control" required="required"> <!-- </div> --> </div> <div class="col-md-4"> <label for="inputJamselesai">End</label> <!-- <div class="form-label-group"> --> <input type="time" name="inputJamselesai" id="inputJamselesai" onchange="javascript: hitungjam();" class="form-control" required="required"> <!-- </div> --> </div> </div> </div> <input id='inputSelisih'>

我尝试了以下操作,但未成功:

curl -k -d '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>wp.getUsersBlogs</methodName><params><param><value>user</value></param><param><value>pass</value></param></params></methodCall>' https://crmpicco.co.uk/xmlrpc.php

我更喜欢使用HTTPie,但是在这种情况下,我不得不回退到cURL。

1 个答案:

答案 0 :(得分:1)

通过HTTPie,您可以使用stdin传递原始请求正文数据,例如:

PAYLOAD='<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>wp.getUsersBlogs</methodName><params><param><value>admin</value></param><param><value>pass</value></param></params></methodCall>'

echo "$PAYLOAD" | http --verify=no https://crmpicco.co.uk/xmlrpc.php 

文档:https://httpie.org/doc#redirected-input