cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURL Beginner Question.

From: <man_at_tfhs.net>
Date: Wed, 10 Jan 2007 14:39:31 -0000

On Wed, Jan 10, 2007, Surya Kiran Gullapalli
<suryakiran.gullapalli_at_gmail.com> said:

> Hello all,
> I'm a newbie to curl. My requirement is i've to post some data to a
> web page, submit it and then get the result.

note here: 'post' and 'submit' are the same thing.

>
> When i looked at the source for the webpage, it looks like this.
>
> <form name=compsearch method=post ...>
> <input type=text name=search_str class=text_box size=15 ...>
>

ok, as long as there is no funny javascript involved with submitting the
form, that is very easy to do with libcurl or curl.

> so i've to enter the search string in search_str text box which is
> located in compsearch form.
>
> How can i submit data like this?
>

assuming that you want to use the libcurl library to post from your C
program, look at the docs for curl_formadd(). it lets you build a 'chain'
of post fields which mimic the browser. then you can use
curl_easy_setopt() and
curl_easy_perform() to submit the data to the server and collect the
response as usual.

assuming you want to use the curl command line tool, try looking at its
docs.

allan

-- 
m. allan noah
IT Director, TfHS.net
ph# (804) 355-5489
tf# (866) 724-9722
fx# (804) 355-0477
Received on 2007-01-10