tags:

views:

85

answers:

5

I am trying to figure out how I can post a message to an http server from the linux shell. What I want is for the shell to post the message and then I can write a small php program to reroute the message to its intended recipient based on the contents and the sender. I cant seem to find a command to do this in Linux. I would really like to stick to a built in utility.

If there is a better frame work that you can think of please let me know.

Thanks

+4  A: 

curl and wget can be used for performing http requests from the shell.

You may want to use some sort of authentication and encryption mechanism to avoid abuse of the URL

Alexandre Jasmin
+1  A: 

You can use curl for this purpose. Have a look at the --data* and --form options in the manpage.

Marcelo Cantos
+4  A: 

The man page for wget has some examples, e.g.

wget --save-cookies cookies.txt \
  --post-data 'user=foo&password=bar' \
   http://server.com/auth.php
nos
+2  A: 

If you want to stick with built in tools use wget and refer to this SO post about posting data with wget: http://stackoverflow.com/questions/1324421/wget-post-data-hwto.

You're going to have to send your data in the post data section and format it on your server side PHP script.

gnucom
+1  A: 

This is what curl is good at.

Nikolai N Fetissov