curl-users
Re: curl script to post to pastie.org
Date: Tue, 16 Feb 2010 17:09:57 -0800
On Feb 13, 2010, at 1:15 PM, Daniel Stenberg wrote:
> 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.
Thank you Daniel, that indeed did the trick. I am up and running.
Thanks again, I appreciate you taking the time to look at this.
If you have a spare second, could you tell me why sending the data in a variable would fail, but pushing it in via < works? I am not following what magic happens when taking the different approach.
-- Scott * If you contact me off list replace talklists@ with scott@ * ------------------------------------------------------------------- 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.htmlReceived on 2010-02-17