curl-users
Re: https/post help
Date: Wed, 30 Jul 2003 17:33:05 -0500
Jared,
You want something like:
curl -H "Host: www.xyz.com" -H "Authorization: Basic <encoded authorization
string here>" -H "Accept: */*" -d @data.txt https://www.xyz.com/csw/serv
let/xmlrequest
David
> HI,
> I'm trying to do an https/post of some xml to a url where I'll get a result
> returned. I'm supposed to include authentication data in the header. Here's
> what I've done.
> 1. Created a file called header.txt with the following data:
> # cat header.txt
> POST http://www.xyz.com/csw/servlet/xmlrequest HTTP/1.0
> Host: www.xyz.com
> Authorization: Basic <encoded authorization sting here>
> Accept: */*
> Content-Type: text/plain
> Content-Length: 452
> 2. Created a file called data.txt where the post data is URI encoded
> # cat data.txt
> %3Ccasa%3E%3Caccount%3E%3Ccustomerid%3E1000%3C%2Fcustomerid%3E%3Cuserid%3E49
> %3C%2Fuserid%3E%3C%2Faccount%3E%3Cproperty%3E%3Cpropstreet%3E18808%20oldhome
> stead%3C%2Fpropstreet%3E%3Cpropunit%3E%3C%2Fpropunit%3E%3Cpropcity%3Eharper%
> 20woods%3C%2Fpropcity%3E%3Cpropstate%3EMi%3C%2Fpropstate%3E%3Cpropzip%3E4822
> 5%3C%2Fpropzip%3E%3Cproptype%3E%3C%2Fproptype%3E%3C%2Fproperty%3E%3Coptional
> %3E%3Ctracking%3E%3Ctracknum%3E987654321%3C%2Ftracknum%3E%3Ctrackname%3EJohn
> %20Smith%3C%2Ftrackname%3E%3C%2Ftracking%3E%3C%2Foptional%3E%3C%2Fcasa%3E
> 3. Run the following command and get the following error:
> # /usr/local/bin/curl -b header.txt -f "file=@data.txt"
> https://www.xyz.com/csw/servlet/xmlrequest
> password:
> curl: (6) Couldn't resolve host 'data.txt'
> curl: (22) The requested URL returned error: 405
> Since I'm getting a 405, I know I'm getting to the server, but the 405 tells
> me that the method is not allowed. This server does support POST's.
> Any recommendations?
> Thanks,
> Jared
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-07-31