r-lib / xml2

Bindings to libxml2
https://xml2.r-lib.org/
Other
220 stars 81 forks source link

Issue with curl::curl_fetch_memory #352

Closed lucaz88 closed 2 years ago

lucaz88 commented 3 years ago

Hi, I wrote a piece of code which automatically fetches the html content from a online repository. It works fine from RStudio on Linux, Win 10 and mac OS but whenever I run it using just R (without RStudio), I get this error:

 Error curl::curl_fetch_memory(url, handle = handle) : 
  Received HTTP/0.9 when not allowed

The code I am running looks like this (! is not a workable example, sorry):

for (i in 1:100) {
  txt <- url(paste0("http://www.mywebsite.com/show?", i), encoding = "UTF-8")
  txt1 <- read_html(txt)
}

Thanks in advance for any help!

hadley commented 2 years ago

This is likely due to some difference in curl::curl_version(); it's unlikely to be directly related to xml2.