draft/getCafe85.R

getCafe85 <- function(){  
  res = POST("http://www.85cafe.com/storeslist.php", body=list(storecity="選擇縣市",storearea="選擇區域")) 
  res2 <- htmlParse(content(res, "text", encoding = "utf8"), encoding = "utf8")
  
  store_nm <- xpathSApply(res2, '//tr/td[1]/a', xmlValue)
  addr <- xpathSApply(res2, '//tr/td[2]/a', xmlValue)
  tel_no <- xpathSApply(res2, '//tr/td[3]/a', xmlValue)
  open_time <- xpathSApply(res2, '//tr/td[4]/a', xmlValue)
  
  cafe85 = data.frame(brand_nm='85度C',store_nm=store_nm,addr=addr,tel_no=tel_no,open_time=open_time,
                      stringsAsFactors=FALSE) 
}
leoluyi/CRMaddress documentation built on May 21, 2019, 5:08 a.m.