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

curl-and-php

Re: cURLing XML

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 28 Nov 2003 21:48:13 +0100 (CET)

On Fri, 28 Nov 2003, Stephen Buckley wrote:

> > Can you describe this other words or possibly showing us some source code
>
> Well, the xml data is generated using miniXML [
> http://minixml.psychogenic.com/index.html ] Very straight forward. Then,
> before I cURL the xml variable, I echo the xml variable, so that I can see
> what the data is looks like. Here is an example of the the echo:

And you want to send (POST) this data *exactly* like this with no encoding
whatsoever and nothing else?

> > Are you actually saying you want to send 'POST / AUTHORIZE HTTP/1.0' as a
> > request? It is a horrible violation of what HTTP is. Is't it supposed tobe
> > POST /AUTHORIZE HTTP/1.0' ?
>
> According the above example, the only thing I can spot is that there is NO
> space between the '/' and 'Authorize', correct? I did not realize that
> could be a problem. I did change that, but still the problem remains.

You achieve the '/AUTHORIZE' by using that path appended to the host name in
the URL you use:

  http://machine.com/AUTHORIZE

The 'POST' is used if you tell curl to POST, and the HTTP version is set by
curl too.

Again: the POST line is not a header, it is the request. You can't alter that
line in curl like you alter other *headers*.

This would be easier if you would again show us your code. For example, you
did try to set a variable in the POST data in a strange way in your previous
code.

> > Also, I would recommend you to NOT attempt to fiddle with Content-length
> > yourself, as you only risk shooting yourself in the foot. curl is
> > perfectly capable of setting this correctly itself.
>
> I certainly did not know this. That is really great. I had originally
> thought I had read that cURL provides as a default the following modifiable
> header bits: Host, Pragma, Accept, and Expect

When you POST with curl, it makes and sends off a perfectly crafted POST
request. Such a request includes Content-Lenght and other headers.

> It helps to know that cURL passes the variable *exactly* as it exists. For
> some reason, to me, the documentation never flatly indicates that.

Perhaps, but then there's nothing that says the opposite either. Feel free to
suggest how to improve the docs with new wordings, replaced paragraphs or
whatever.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
Received on 2003-11-28