Page 1 of 1

Post XML document to URL

Posted: Thu May 13, 2010 3:52 pm
by jwbuzz
Anyone have example code that shows how to post an XML document to a URL?
Justin

Re: Post XML document to URL

Posted: Thu May 13, 2010 4:05 pm
by jwbuzz
I found a command like the following... I'll give it a try.

Code: Select all

post data to URL destinationURL

Re: Post XML document to URL

Posted: Thu May 13, 2010 4:06 pm
by Mark
Hi Justin,

You need a script similar to the following:

Code: Select all

put "xml=" & url "binfile:~/documents/somefile.xml" into myData
post myData to URL "http://www.domain.com/whatever.cgi"
You may need to url encode the data:

Code: Select all

put url "binfile:~/documents/somefile.xml" into myData
put "xml=" & urlEncode(mydata) into myData
post myData to URL "http://www.domain.com/whatever.cgi"
Best,

Mark