draft/getFtc.R

getFtc <- function(){
  
  url      <- 'http://www.ftc.com.tw/oil/gettotalstation.asp'
  htmldoc1 <- GET(url, encoding='utf8',user_agent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36"))
  htmldoc2 <- htmlParse(htmldoc1, asText = TRUE, encoding='utf8')
  tables   <- readHTMLTable(htmldoc2)
  
  data2 <- data.frame('福懋加油站',tables[[1]][2],tables[[1]][3],tables[[1]][4],tables[[1]][6])
  
  names(data2) <- c("brand_nm","store_nm","addr","tel_no","self")
  data2
}
leoluyi/CRMaddress documentation built on May 21, 2019, 5:08 a.m.