CURL:将XML数据发布到服务器[cmdline WINDOWS]

时间:2016-04-14 13:58:35

标签: xml bash post curl cmd

我试图通过CURL将XML发布到REST API:

λ curl -X POST  -H "Content-Type: application/xml" http://localhost/vcardservice -d '<?xml version='1.0' encoding='ISO-8859-1' standalone='yes'?><ns2:vCardRequestStore>
    <vcardRequestList> <vcardRequest></vcardRequest></vcardRequestList></ns2:vCardRequestStore>'

但无效

Error:
    < was unexpected at this time.

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

尝试使用数据有效负载内的转义双qoutes

<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"?> ...