7
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 – 2016-12-25T18:44:23.013
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 – 2016-12-25T19:20:13.120
2sprunge seems to be down (503)? – devRicher – 2016-12-25T22:41:15.643
Bummer! :( Maybe I should remake this question to use ptpb.pw...
– Winny – 2016-12-26T02:37:18.237@devRicher looks like it's back up, sorry about that. I have no control over sprunge.us. – Winny – 2016-12-26T05:43:46.643
Why can't we write a function? – Rɪᴋᴇʀ – 2016-12-27T15:37:49.903
And I doubt anybody will improve on that curl code. (though if I've golfed the code, can I post an answer using the golfed curl code?) – Rɪᴋᴇʀ – 2016-12-27T15:38:49.433
I'm going to revise the question to allow functions & yes you can base your solution off my example. – Winny – 2016-12-28T02:58:15.297
I agree the example I gave was a bit too concise for a code golf challenge. With any luck, somebody will come up with a curious alterative. – Winny – 2016-12-28T03:04:15.720