cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Tanmay Anjaria <tanmay.anjaria_at_gmail.com>
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
YouTube:

curl \
  --location https://www.google.com/youtube/accounts/ClientLogin \
  --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.

Response:
Auth=AIwbFARksypDdUSGGYRI_5v7Z9TaijoPQqpIfCEjTFPAikn_---OC-I1VJtQ

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?

Thanks,
Tanmay

On Sat, Jan 10, 2009 at 1:23 PM, Dan Fandrich <dan_at_coneharvesters.com>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
> --
> http://www.MoveAnnouncer.com The web change of address
> service
> Let webmasters know that your web site has moved
>
Received on 2009-01-10