0

Is there equivalent way to make this cURL call with HTTPie?

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

I have tried the following without any success:

http --pretty=all --verify=no POST https://crmpicco.co.uk/xmlrpc.php data="<?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>"

I prefer using HTTPie, but in this instance i've had to fallback to cURL.

Jens
  • 8,423
  • 9
  • 58
  • 78
crmpicco
  • 16,605
  • 26
  • 134
  • 210

1 Answers1

4

With HTTPie you use stdin to pass raw request body data, for example:

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 

Documentation: https://httpie.org/doc#redirected-input

Jakub Roztocil
  • 15,930
  • 5
  • 50
  • 52
  • 1
    Great, thanks. Doable without setting the variable too, e.g. `echo 'wp.getUsersBlogsadminpass' | http --verify=no https://crmpicco.co.uk/xmlrpc.php` – crmpicco Mar 11 '19 at 07:35