cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: 411 Length required

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Dec 2007 11:29:08 +0100 (CET)

On Fri, 14 Dec 2007, shallway wrote:

> Will you help me please! Here's what's confusing me these days.
> Environment: I have Apache2.2/PHP5.2.3 with cUrl PHP integreted. The curl
> function was tested out thru some testing page.

What libcurl version?

> 5.I passed $test_itme to insertItem and it looked like this:
> insertItem($test_item, $token). Then I got this :
> Length Required
> POST requests require a Content-length header.

That seems odd. But your example was way too complicated for me to fully
understand what you did and what libcurl would think of that. A typical POST
will (should) indeed include a Content-Length header but that is done by
libcurl automatically so I'm a bit puzzled how you could avoid that!

Can you make a very simple and small example that just sends a single POST
that gives you this error?

> 6.I tried to see what was curl doing. So I add 2 line2 to the above function
> :
> $info = curl_getinfo($ch);
> var_dump($info);
> 7.I noticed the 'Content-Type' field was 'text/html;charset=utf-8' from the
> output.While it should be 'application/atom+xml' just like the code setted.

You need to consider that you send one Content-Type in the request and you
receive another one in the response. The fact that you got a response saying
that content-type may be in indication to a problem somewhere in your script,
but it is what the server sent back to you and it is hardly PHP/CURL's
fault...

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-12-14