# This is a very simple script, which demonstrates how ‹curl› can be # used to send data to a remote server, using so-called ‹POST› # requests. This script can be really useful in case you want to # send the output of a command or the content of a plain text file # to someone across the internet. # We use a web service called ‹ix.io› which will hold text for us, # and lets us send it using a simple POST request. Basically a # no-frills pastebin. echo hello world | curl -F 'f:1=<-' http://ix.io # The ‹-F› argument to ‹curl› is short for ‘form’, and uses the # ‹POST› protocol in a manner similar to how a web browser would use # it to send data you filled in an HTML form. ‹f:1› is the name of # the key and the ‹<-› is an instruction to read the value for that # key from ‹stdin›. # After the script runs, you can try fetching (with just ‹curl›) the # resulting URL. You should get back ‹hello world›. # That's all for the user-level part, let's do some C: # # $ micro ghbn.c