抓取验证码
library(RCurl)
## Warning: package 'RCurl' was built under R version 3.2.3
## Loading required package: bitops
myHttpheader <- c("Accept"="image/webp,*/*;q=0.8","Accept-Encoding"="gzip,deflate,sdch","Accept-Language"="zh-CN,zh;q=0.8","Cache-Control"="no-cache","Connection"="keep-alive","Pragma"="no-cache","Referer"="http://bbs.shangdu.com/s/regform.htm","User-Agent"="Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36")
url <- "http://tjcredit.gov.cn/verifycode?date=1461146339377"
png <- getBinaryURL(url, httpheader=myHttpheader)
writeBin(png, con="E:\\新技术\\爬虫\\验证码/111.png")
## NULL
for(i in 1:10) {
url1 <- "http://tjcredit.gov.cn/verifycode?date=1461145953254"
png <- getBinaryURL(url1)
file_name <- paste("E:\\新技术\\爬虫\\验证码/", i, ".png", sep="")
writeBin(png, file_name)
}