views:

314

answers:

3

I need to launch curl for a test. I need to send XML which has " / and other crazy things. Whats the quickest way to do it? I tried

curl -k -d '<xs:element name="Login"/>' https://thewebsite.com/page.exe

with no luck.

A: 

Backslash escape it.

\"
Charlie Somerville
hmm, i tried in a batch file with no luck. I didnt think bash would allow it. It echos properly.
An employee
This didn't work for you but you accepted it as an answer?
brian d foy
brian d foy: in batch file. I didnt think to try on a bash. It does work in bash
An employee
+3  A: 

In Perl, use the list form of system:

system curl 
    => qw(-k -d '<xs:element name="Login"/>' https://thewebsite.com/page.exe);

Or, better yet, use WWW::Curl (see also the libcurl documentation).

Sinan Ünür
+2  A: 

The use of 'qw' to quote parameters given in one of the answers here is not correct, qw will explictly escape and pass the single quotes around the xs tag, where as in the OP's example, they wouldn't

You could use...

system('curl', '-k', '-d', '<xs:element name="Login"/>', 
       'https://thewebsite.com/page.exe');

Which should be what you're after. I'd try to use the module though.

reasonableKeith