如何使用cmd在Windows 7中使用cURL发布XML数据? [英] How to post XML data with cURL using cmd in windows 7?

查看:317
本文介绍了如何使用cmd在Windows 7中使用cURL发布XML数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在命令行使用curl发布一些xml数据。特别是我试图运行以下命令连接到记帐服务提供商:

  curl https://core.spreedly。 com / v1 / gateways.xml \ 
-u'secretKey'\
-H'Content-Type:application / xml'\
-d'< gateway> gateway_type> test< / gateway_type>< / gateway>'

 <是意想不到的。 

如何输入我的xml数据?

中来转义




您需要说

 < gateway>< gateway_type> test< / gateway_type>< / gateway>


I am trying to post some xml data using curl on command line. Particularly I m trying to run the following command to connect to a billing service provider:

curl https://core.spreedly.com/v1/gateways.xml \
    -u 'secretKey' \
    -H 'Content-Type: application/xml' \
    -d '<gateway><gateway_type>test</gateway_type></gateway>'

However I m keep getting the following error:

< was unexpected at this time.

How should I type my xml data?

解决方案

Redirection symbols can be escaped by placing those within double quotes ".

Instead of saying

'<gateway><gateway_type>test</gateway_type></gateway>'

you need to say

"<gateway><gateway_type>test</gateway_type></gateway>"

这篇关于如何使用cmd在Windows 7中使用cURL发布XML数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆