cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl script to post to pastie.org

From: Scott Haneda <talklists_at_newgeo.com>
Date: Sat, 13 Feb 2010 13:06:59 -0800

I never got anywhere on this one, and have been fiddling with it a while now, I thought I would give the list one last shot before I abandon the idea:

I have distilled down to a simple shell script:

#!/bin/bash
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 curl command is all one line, you can get it cleanly out of here: http://pastie.org/808664

It works a lot of the time. Right now, I have this for curly.txt:
cat ~/Desktop/curly.txt
<

So there is a literal less than symbol in the file, returning to me the value for url_effective as: http://pastie.caboo.se/pastes/create (incorrect)

When it does work, if I were to put the contents of this email into a second file...

I get back this url: http://pastie.org/808674
* Odd that I can have the < in the file, just not as a first character. Though I am wiling to bet that there are other characters, quotes, tic marks, etc, that will hang it up. I have tried encoding it, and only end up with encoded literals in the resulting pasite.

Suggestions? Thanks in advance.

-- 
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.html
Received on 2010-02-13