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

curl-and-php

Re: Error sending/receiving XML via curl

From: Ken Harris <kharris_at_lhinfo.com>
Date: Wed, 24 Sep 2003 17:23:33 -0400

Try this. Most XML data is "just text" and can be transferred as such. Here
are the options I use based on the curl manpages.
  /*
   || CURL options:
   || CURL -m 120 = allow 2min for the whole transfer
   || -A = User Agent
   || -d = data
   || By default, CONTENT-TYPE = application/x-www-form-urlencoded
  */
  $cURL = '/usr/local/bin/curl';
  $uAgnt = "-A 'Mozilla/4.5'";
  $timeout = '-m 120';
  $fields = sprintf ( "-d '%s'", trim ( $xmlStream ));
  $cmd = sprintf ( "%s %s %s %s %s",
                    $cURL, $timeout, $uAgnt, $fields, $gProcessURL );

  This equates to:

  /usr/local/bin/curl -m 120 -A 'Mozilla/4.5' -d 'xmldata' http://someURL

  which works fine for me.

Ken

Quoting Bennett <bennett_at_glengroup.com>:

> Hi,
>
> I'm trying to use curl/php to post to a servlet that receives and
> returns xml.
>
> Here's the command line I'm trying:
>
> /usr/bin/curl -m 30 --data-binary $data_to_send http://$host:$port$path
> -L
>
> where $data_to_send is a urlencoded xml stream.
>
>
> and the error I'm receiving is:
>
> Content is not allowed in prolog.
>
> I've ensured that there's absolutely nothing before the "<?xml
> version..."
> in $data_to_send (hidden or otherwise)
>
>
> Does anyone have any ideas?
>
> Please help,
>
> TIA

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-24