Posting XML via Command Line with cURL

dkblackhawk

New Member
What's the right way to handle XML that is being used in a cURL POST via command line? I noticed that at least, the first "<" needs to be escaped, which seems odd since the value is a POST var.\[code\] curl -F 'XMLPayload=\<?xml version="1.0" encoding="UTF-8"?><TEST_PO><Message>Hi Test</Message></TEST_PO>' -H "X-SECURITY-USERID: tester" -H "X-SECURITY-PASSWORD: password" http://www.site.com\[/code\]This works, too without the escaping requirement:\[code\]curl --data 'XMLPayload=<?xml version="1.0" encoding="UTF-8"?><TEST_PO><Message>Hi Test</Message></TEST_PO>' -H "X-SECURITY-USERID: tester" -H "X-SECURITY-PASSWORD: password" http://www.site.com\[/code\]
 
Back
Top