[R] writing binary data from RCurl and postForm

Hadley Wickham h.wickham at gmail.com
Thu Aug 6 00:47:38 CEST 2015


> I think that is because the value returned from postForm has an attribute;
> remove it by casting the return to a vector
>
>   fl <- tempfile(fileext=".pdf")
>   writeBin(as.vector(postForm(url, binary=TRUE)), fl)
>
>
> The httr package might also be a good bet
>
>   writeBin(content(POST(url)), fl)

Or write response directly to disk with

POST(url, write_disk(fl))

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list