cURL / Mailing Lists / curl-library / Single Mail


Re: POST request either full of trash or cropped

From: Daniel Stenberg <>
Date: Tue, 21 Jul 2009 00:25:15 +0200 (CEST)

On Mon, 20 Jul 2009, Daniel Spies wrote:

> <form method='post' name='doaction' action='create.php?open=new'>
> <input type='hidden' name='randomval' value='831856300'>
> <a href='#'' onCLick='document.doaction.submit()'>Do it now!</a><br /><br
> />

This is not a multipart post.

> Note: there is really no </form> tag, but I cannot change it. The form
> works through a browser, though. And there is no OnSubmit() Event...

LiveHTTPHeaders is your friend.

> curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost);

This is thus the wrong kind of post.

> The other try was the following:
> curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, "randomval=123456789";

You will most probably need to first get the HTML page and fetch the cookies
and the random value, then submit the post with the correct value.

> curl_easy_perform(curl_handle);
> That one gives me a nice tiny packet, but the data is cropped. This is a
> packet:

> Any idea? Am I doing something wrong?

This is very basic functionality in libcurl that is used and tested a lot in
every version by a very large number of users. I would suggest that the
problem is rather in your app somehow. Did you run valgrind on it? Can you
show us a full example that repeats the problem?

Received on 2009-07-21