Use Rcurl to send script data to an API endpoint (Javascript based)

I am struggling to send some dynamic data to an API endpoint which is running on localhost on my system. I am using Rcurl with postForm but somehow not able to see the data on API.

This is the script I am using:

library(RCurl)
tot <- 5
n <- 2 ^ 20
inside <- 0
total <- 0

####### create progress bar
pb <- txtProgressBar(min = 0, max = tot, style = 3)
for(i in 1:tot){
for (j in 1:100){
x <- runif(n)
y <- runif(n)
r <- x ^ 2 + y ^ 2
inside <- inside + sum(r <= 1)
total <- total + n
inside * 4 / total
Sys.sleep(0.1)
# update progress bar
setTxtProgressBar(pb, i)
}
url <- "http://localhost:3000/progressR"
form <- postForm(url, placeholder = i)
str(form)
}
close(pb)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.