cURL / Mailing Lists / curl-library / Single Mail


Re: Problem posting XML (content is not allowed in prolog)

From: Daniel Stenberg <>
Date: Wed, 18 Feb 2009 11:06:55 +0100 (CET)

On Tue, 17 Feb 2009, BINETTE Pascal wrote:

> I've been spending about 5 days on this problem, and I can't get this to
> work. Basically I'm trying to communicate with an XML Server, and while I
> can communicate with the server, it doesn't recognize what I'm sending it; I
> can getting the "content is not allowed in prolog" response.
> <form action="eex-xmlserver/request" method="post"
> enctype="multipart/form-data">
> I tried just about everything, encoding in several formats (URL encoding,
> Base 64, XML entities), I also tried using the regular POST versus the HTTP
> POST, I tried sending a file versus sending the XML tags as a string, etc.
> I'm now out of options.

The enctype spells out multipart/form-data. So that's what you should use, and
then there's no particular encoding for you to do.

> curl_formadd(&post, &last, CURLFORM_COPYNAME, "xml",

Try CURLFORM_FILE instead of CURLFORM_COPYCONTENTS to let libcurl read and
deal with the file on its own.

Do you have any other tool/client that speaks the correct protocol? Can you
compare what that sends with what your libcurl client sends?

Received on 2009-02-18