I've been looking at the FSharp.Data package, which looks very useful, and have seen how to do basic requests...
let html = Http.RequestString("http://example.com")
I would like to use this to access password-protected pages, but can't see how to do it. Looking at the HttpRequestHeaders page, it looks like I should be able to pass in some headers to include the information, but I'm not sure how to do it.
That page links to a code sample that includes the following function...
let BasicAuth (username:string) (password:string) =
let base64Encode (s:string) =
let bytes = Encoding.UTF8.GetBytes(s)
Convert.ToBase64String(bytes)
sprintf "%s:%s" username password |> base64Encode |> sprintf "Basic %s" |> Authorization
...which looks like it's creating the info necessary, but I don't know what to do with it next.
Anyone able to help? Thanks