Skip to content

Instantly share code, notes, and snippets.

@JogoShugh
Last active August 29, 2015 14:06
Show Gist options
  • Save JogoShugh/55df12b8bc5630fd3cf2 to your computer and use it in GitHub Desktop.
Save JogoShugh/55df12b8bc5630fd3cf2 to your computer and use it in GitHub Desktop.
namespace VersionOne.Utility.Functional
open System.Net
open System
open System.IO
open Newtonsoft.Json
open Newtonsoft.Json.Linq
module Web =
let FetchUrl url =
let req = WebRequest.Create(Uri(url))
use resp = req.GetResponse()
use stream = resp.GetResponseStream()
use reader = new IO.StreamReader(stream)
reader.ReadToEnd()
let FetchJsonUrl url =
let content = FetchUrl url
JObject.Parse content
namespace VersionOne.Utility.Functional [
open System.Net;
open System;
open System.IO;
open Newtonsoft.Json;
open Newtonsoft.Json.Linq;
module Web [
let FetchUrl -url- = [
let req = WebRequest.Create(Uri(url));
use resp = req.GetResponse();
use stream = resp.GetResponseStream();
use reader = new IO.StreamReader(stream);
return reader.ReadToEnd();
]
let FetchJsonUrl -url- = [
let content = FetchUrl url;
return JObject.Parse content;
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment