Thursday, May 07, 2009

A simple way with curl to post code snippet to ubuntu paste:


$ curl -v -d 'poster=chengrq&syntax=python' --data-urlencode 'content@/home/gektop/bin/diff-filter' http://paste.ubuntu.com
* About to connect() to paste.ubuntu.com port 80 (#0)
* Trying 91.189.90.174... connected
* Connected to paste.ubuntu.com (91.189.90.174) port 80 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8j zlib/1.2.3
> Host: paste.ubuntu.com
> Accept: */*
> Content-Length: 3002
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 302 Found
< Date: Fri, 08 May 2009 01:29:08 GMT
< Server: Apache/2.2.8 (Ubuntu) mod_python/3.3.1 Python/2.5.2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8
< Location: /166435/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host paste.ubuntu.com left intact
* Closing connection #0

No comments: