I am using Tor in combination with R and would like to change my IP for each new request. The code I have is as follows:
library(RCurl)
opts <- list(proxy="127.0.0.1", proxyport=8118)
for (i in 1:10)
{
con <- socketConnection(host="127.0.0.1",port=9051) # DOES NOT WORK
writeLines("signal newnym", con=con) # DOES NOT WORK
ip <- getURL("http://ifconfig.me/ip", .opts = opts)
print(ip)
Sys.sleep(1)
}
I am able to connect via Tor, however the two lines marked as 'DOES NOT WORK' don't seem to get the proper signal across to Tor, so the IP stays the same.
Regards!