Changing Tor identity in R Changing Tor identity in R r r

Changing Tor identity in R


I had a similar problem, but managed to make it work after installing Privoxy as a http-proxy and setting it up as explained here. Then, this is the code I used in R:

library(RCurl)# check current IP addressprint(getURL("http://ifconfig.me/ip"))# proxy optionsopts <- list(proxy="127.0.0.1", proxyport=8118)# opening connection with TORcon <- socketConnection(host="127.0.0.1",port=9051)print(getURL("http://ifconfig.me/ip", .opts = opts))  for (i in 1:10)    {    writeLines('AUTHENTICATE \"password\"\r\nSIGNAL NEWNYM\r\n', con=con)    Sys.sleep(5)    print(getURL("http://ifconfig.me/ip", .opts = opts))     Sys.sleep(5)    }  

Make sure you are using manual settings for the TCP connection, with address 127.0.0.1:9051, and the authentication method is "password", substituting the password between double quotes in the code above with the one you set.