0

I am trying to POST an xml object using httr

In my application, I am creating the XML object like this:

  doc <- htmlTreeParse(conts, useInternalNodes = T)
  xmlFormula <- xpathSApply(doc, "//*/textarea", xmlValue)
  x <- xmlParseString(xmlFormula)

Then I modify the xml on the fly

and now want to post it using httr without saving it to disk and uploading from a file

  POST(MYURL, body=x) # this won't work 

Is there a method to make the xml object httr friendly?

  • And by "wont work", what do you mean exactly? Can you actually create a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – MrFlick Nov 03 '14 at 00:31
  • 1
    You can try `POST(MYURL, body=saveXML(x))` however it is hard to help with out a reproducible example demonstrating the issue. – jdharrison Nov 03 '14 at 00:58
  • By not work, I mean I got Access denied error. I now replaced httr by postForm and it went through: `postForm(url, "xml"=saveXML(x), curl=curlobj, style="post")` worked. I guess I need to figure out how to do this with httr. – Ruby Spring Nov 04 '14 at 02:22

0 Answers0