I was trying to download a file from https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download in R with download.file() function. It turns out that the request was rejected by the host. Then I tried
httr::GET(url=url, add_headers("User-Agent"="Mozilla/5.0"))
to fake headers, but it was still not working. It was weird as the same trick was applied in Python and passed the test with a status code of 200.
How can I resolve this? Thank you.