From: Daniel Stenberg Date: Mon, 27 Mar 2000 21:42:40 +0000 (+0000) Subject: Added some more explanatory text about HTTP posts X-Git-Tag: curl-7_1_1~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e67157b5a2e22a52293eb9bba52079052b091c27;p=thirdparty%2Fcurl.git Added some more explanatory text about HTTP posts --- diff --git a/README.curl b/README.curl index 7cddbca6c8..ce2cba1d16 100644 --- a/README.curl +++ b/README.curl @@ -194,6 +194,41 @@ POST (HTTP) curl -d "name=Rafael%20Sagula&phone=3320780" \ http://www.where.com/guest.cgi + How to post a form with curl, lesson #1: + + Dig out all the tags in the form that you want to fill in. (There's + a perl program called formfind.pl on the curl site that helps with this). + + If there's a "normal" post, you use -d to post. -d takes a full "post + string", which is in the format + + =&=&... + + The 'variable' names are the names set with "name=" in the tags, and + the data is the contents you want to fill in for the inputs. The data *must* + be properly URL encoded. That means you replace space with + and that you + write weird letters with %XX where XX is the hexadecimal representation of + the letter's ASCII code. + + Example: + + (page located at http://www.formpost.com/getthis/ + +
+ + + + +
+ + We want to enter user 'foobar' with password '12345'. + + To post to this, you enter a curl command line like: + + curl -d "user=foobar&pass=12345&id=blablabla&dig=submit" (continues) + http://www.formpost.com/getthis/post.cgi + + While -d uses the application/x-www-form-urlencoded mime-type, generally understood by CGI's and similar, curl also supports the more capable multipart/form-data type. This latter type supports things like file upload.