curl HTTP post
curl HTTP post
I am trying to POST an HTTP request to a business partner's web site using the Linux curl command, but I am having trouble sending all my content. They want the message formatted as a MIME message (Content-type: multipart/mixed), but I am beginning to wonder if I can to do this with curl. From the man page and what I can find on the web, I should be able to format the necessary headers, but curl doesn't seem to want to include all the data I am trying to send.
The message I am trying to POST is supposed to follow the format shown below:
Content-type: multipart/mixed; boundary=BOUNDARY Content-length: nnnn --BOUNDARY Content-type: application/x-www-form-urlencoded Content-length: nnn Parm1=Data1&Parm2=Data2&Parm3=... --BOUNDARY Content-type: application/x-appl-specific-type Content-length: nnnn <bunch of binary data> --BOUNDARY--
I have everything after the first Content-length header in a file, lets call it "my-bin-file" for this example. My curl command is coded as follows:
curl --include --header "Content-type: multipart/mixed; boundary=BOUNDARY" --header "Content-length: 1493" --data-binary @my-bin-file --output my-output-file https://www.my-business-partner.com/incoming
Running on RHEL: "User-Agent: curl/7.12.1 (x86_64-redhat-linux-gnu) libcurl/7.12.1"
The contents of my-bin-file do not appear to be getting included in the post. I get back a properly formatted response indicating the my POST was missing data. From what I can see curl is only including the first 15 bytes from my-bin-file, which doesn't make any sense to me.
Code what you mean,
and mean what you code!
But by all means post your code!