curl-users
Re: problem with POST on Redirecting!
Date: Mon, 9 Dec 2002 09:00:42 +0100 (MET)
On Sun, 8 Dec 2002, Sanjeev wrote:
> Now i continued my c-program with curl. I will comeback to you if i get any
> probs. Of course there are two issues, which i'm using a workaround
> though:
I'd recommend you to take libcurl development talk over to the curl-library
list where you'll find many other libcurl-using developers. This reply is
cc'ed over there.
> -------------------------------------------------------
> sprintf(extr,"%s","f_sev=1&f_m_st=1&f_m_num=1&submit=Submit");
>
> sprintf(tmp,"\"f_sub=\"%s\"&f_des=\"%s\"&%s\"",subj,desc,extr);
>
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, tmp);
> ------------------------------------------------
> for this the probs are:
> 1) in the seconf sprintf statement, the first field is being stripped off
> while submitting. i.e f_sub="" is not being submitted in the POST.
I don't believe you're right when saying this. Can you post a VERBOSE or
DEBUGFUNCTION output that proves this?
libcurl doesn't strip anything. It sends whatever you tell it to send.
I do however find it very unlikely that you should put the whole POST data
within double quotes the way you do. Why does your string begin and end with
\" ?
> 2) for the f_desc="..." there is a lot of data, with so many keybord
> characters including """ and "'" for this with the help of my friend i
> converted it to, before submitting...
>
> while(mtmp = strchr(tmp,'\'')) {
> *(mtmp) = '#';
> }
>
> which changes all of the "'" to "#" from the above said 'tmp' variable and
> then submits
Why do you convert them like that? The data you send in a POST is supposed to
be URL-encoded in case they can't be sent as-is.
' should become %27 and " should become %22 if you don't want to send them.
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, tmp);
> -----------------------------------------------
>
> Also when we are submitting,
> if we specify verbose, we get the details to stdout.
I believe you get VERBOSE sent to stderr. Use DEBUGFUNCTION to deal with it
the way you think fits better.
> in any case we get the fetched page to stdout.
If you want to, yes.
> What if i wanted to just submit the page and dont want any output. Ofcourse
> we have an option to send it to a file. What if i dont even wanted to send
> the output to a file. Is there a way if i wanted to run my code in a
> complete silent mode??
Of course. Make a write callback that receives all data instead of the
default, and then don't do anything in the callback except return the correct
value back to libcurl.
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sfReceived on 2002-12-09