cURL / Mailing Lists / curl-library / Single Mail


Re: cURL on Windows Xp: "Content-Length Header required" error

From: Tanmay Anjaria <>
Date: Sat, 10 Jan 2009 14:00:59 +0530

Thank you for a prompt response.

Yes, you were wright in saying that the URL string was not right.

AS I mentioned, I am new to cURL and thus by mistake, all the 3 command line
args that I wanted to post to curl, I gave them in URL string.

Below mentioned are the 3 command line args that I wanted to send to

curl \
  --location \
  --data 'Email=testuser&Passwd=testpw&service=youtube&source=Test' \
  --header 'Content-Type:application/x-www-form-urlencoded'

Response to this will be an authentication key.


I know how to post separate commands from command line in cURL but can
you tell me how do I
send all three of these together so that I can get an authentication
code from YouTube as a response?


On Sat, Jan 10, 2009 at 1:23 PM, Dan Fandrich <>wrote:

> On Sat, Jan 10, 2009 at 11:32:44AM +0530, Tanmay Anjaria wrote:
> > While executing the curl_perform it come out with an error saying that
> > "content-length header required" Please find the error.html file attached
> > hereby.
> >
> > Can some one please let me know how this can be resolved?
> What exactly is the code you're running? Obviously, the code below isn't
> quite it. For one, the URL is wrong--it looks like a set of curl
> command-line
> arguments and not just a URL. Secondly, the libcurl POST code is mostly
> commented out.
> Even if the code were uncommented, it wouldn't work. CURLOPT_POSTFIELDS
> shouldn't hold an HTTP header like Content-Length but rather the data to
> send. But that's a bad way to send a large file like a video--use a read
> callback instead.
> Take a look at the example program post-callback.c to see how it should be
> set up.
> >>> Dan
> --
> The web change of address
> service
> Let webmasters know that your web site has moved
Received on 2009-01-10