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

curl-and-php

Data in headers

From: David Durant <ddurant_at_cox.net>
Date: Wed, 10 Oct 2007 12:36:20 -0400

Is there a way to send raw data (text/xml) inside the headers of a POST
command?

I'm trying to emulate the output javascript output of
ActiveXObject("Microsoft.XMLHTTP"),
which injects the request data into the headers. Everything I've tried
with curl and/or http_post_data
sends the headers with "Expect: 100-continue", waits for the Continue
response from the server (which
it gets), then sends the data. Unfortunately this is not working correctly.

This is javascript I'm trying to emulate:

    var request = new ActiveXObject("Microsoft.XMLHTTP");
    function sendRequest()
    {
        request.open("POST","http://staging.connect2data.com",false);
        request.send(document.getElementById('XML').value);
        document.getElementById("response").value = request.responseText;
   
    }

The only packet that gets sent by this look like: (captured with
Wireshark) (private XML data removed)

POST / HTTP/1.1
Accept: */*
Accept-Language: en-us
Referer: file://C:\Users\Dave\Documents\RealQuest Info\c2dtest.htm
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
.NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; .NET CLR
1.1.4322)
Host: staging.connect2data.com
Content-Length: 1062
Connection: Keep-Alive
Cache-Control: no-cache

<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE REQUEST_GROUP SYSTEM "C2DRequestv2.0.dtd">
<REQUEST_GROUP MISMOVersionID = "2.1">
</REQUEST_GROUP>

Notice the headers end with "Cache-Control: no-cache" followed by \r\n,
then the xml data.
Can this be done with curl?

Thanks,
Dave
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-10-10