I am trying to use this snippet:
open("data.csv", "wb") do |file|
file << open("https://website.com/data.php", http_basic_authentication: ["username", "password"]).read
end
But instead of the desired CSV file, I get just downloaded the HTML code of the website. What's the problem? When I access the URL and I am not logged in, then it's displayed the form for login (not the HTTP authentication window). How to solve this situation?
Thanks