cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl script to post to pastie.org

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 13 Feb 2010 22:15:37 +0100 (CET)

On Sat, 13 Feb 2010, Scott Haneda wrote:

> THEDATA=`cat ~/Desktop/curly.txt`

> curl http://pastie.caboo.se/pastes/create -H 'Expect:' -F
> 'paste[parser]=plaintext' -F "paste[body]=$THEDATA" -F
> 'paste[authorization]=burger' -s -L -o /dev/null -w '%{url_effective}'

The data like that will no doubt fail depending on the file contents. I would
instead suggest you tell curl to get the contents off the file. Like this:

curl http://pastie.caboo.se/pastes/create -H 'Expect:' -F
'paste[parser]=plaintext' -F "paste[body]=<filename" -F
'paste[authorization]=burger' -s -L -o /dev/null -w '%{url_effective}'

... where 'filename' is ~/Desktop/curly.txt or suitable.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-13