# Sprunge this! Sprunge that!

Your task is to create a program or function that creates a paste on sprunge.us. Your program/function must receive the text to sprunge from your language's usual input mechanism, such as standard in; or in the case of a function, it can be a string or whatever makes the most sense to you. Your program will POST the text from input to http://sprunge.us/ as multipart/form-data with the form field name of sprunge. Finally, your program will output/return the URL sent back in the reply from the POST.

This is a code golf, so shortest answer (in bytes) wins.

Here is an example solution using bash and curl taken directly from the sprunge.us website. Feel free to use it in your own golf:

curl -F 'sprunge=<-' http://sprunge.us

Which returns the URL to the paste, which looks like http://sprunge.us/aXZI, where the aXZI is the ID of the sprunge.

This is my first code golfing challenge, please let me know if this is too easy or not creative enough

• So, you're not allowed to write a function? Nice challenge, by the way. – XavCo7 Dec 25 '16 at 18:44
• Correct, it must be a complete program. Thanks by the way. I have a feeling there might not be much room for improvement from the curl example... I could make this a popularity contest if that's the case. – Winny Dec 25 '16 at 19:20
• sprunge seems to be down (503)? – devRicher Dec 25 '16 at 22:41
• Bummer! :( Maybe I should remake this question to use ptpb.pw... – Winny Dec 26 '16 at 2:37
• @devRicher looks like it's back up, sorry about that. I have no control over sprunge.us. – Winny Dec 26 '16 at 5:43

# Bash, 29 25 bytes

curl -F sprunge{=\<-,.us}

Thanks to @Score_Under for providing this awesome solution!

Old solution:

curl -Fsprunge=\<- sprunge.us

Quotes around 'sprunge=<-' are unnecessary, as long as the < is escaped.

EDIT: Interestingly, this alternative way has the exact same length:

a=sprunge
curl -F$a=\<-$a.us
• Can be shorter with careful use of brace expansion: curl -F sprunge{=\<-,.us} – Score_Under Jul 5 '17 at 1:23
• @Score_Under Thanks! updated – markasoftware Jul 15 '17 at 16:38
• @Markasoftware The space between F and s is important. – Anders Kaseorg Jul 16 '17 at 0:05

# HTML, 88 bytes

<form action="http:sprunge.us" method="POST"><textarea></textarea><button type="submit">

To test this easily, prepend data:text/html, to the code and paste it into your address bar (works for me on chrome).

Full (easily) testable code:

data:text/html,<form action="http:sprunge.us" method="POST"><textarea></textarea><button type="submit">
• You ought to be able to replace http: with //. – Jordan Jan 5 '17 at 3:03
• @Jordan not for me? I think that looks for a file, not a http:// address. – Rɪᴋᴇʀ Jan 5 '17 at 3:48
• //sprunge.us is a protocol-relative URL, so if it appears on an HTTPS site it'll resolve to https://sprunge.us and if it appears on an HTTP site it'll resolve to http://sprunge.us, so it might not work if you're trying it on an HTTPS site and sprunge.us only works with HTTP. Barring that, I dunno, and I'm not at a computer so it's impractical for me to test. Sorry! – Jordan Jan 5 '17 at 3:52
• @Jordan it doesn't work, that's all I know. – Rɪᴋᴇʀ Jan 5 '17 at 14:34

# Bash, 30 bytes

curl -F'sprunge=<-' sprunge.us

Just removed the unneeded space in -F 'sprunge=<-' and the http:// from the sprunge.us url. OP gave me explicit permission to golf his reference solution.