My sincere apologies if this question sounds silly or has already been asked; what is the standard way to read in a text file in the same sense that readFile does, except if the file is online?
I am of course given a URL as input, like the following example
https://dotnetperls-controls.googlecode.com/files/enable1.txt
What libraries do I import? Are there good references I can consult for this kind of web-based IO in Haskell?
*Please edit the tags as you see fit.
This is a reproduction of @user2407038's comment, for the sake of having an answer.
import Network.HTTP
main = do
response <- simpleHTTP $ getRequest "http://www.google.com/robots.txt"
let body = fmap rspBody response
print response
print body
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With