Skip to content

Instantly share code, notes, and snippets.

@willf
Created June 8, 2010 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willf/430657 to your computer and use it in GitHub Desktop.
Save willf/430657 to your computer and use it in GitHub Desktop.
Do a synchronous http request
open System
open System.IO
open System.Net
open System.Web
// get contents synchronously
let http_sync (uri:Uri) =
let reader = new StreamReader(WebRequest.Create(uri).GetResponse().GetResponseStream())
reader.ReadToEnd()
let original_query = "florists in Miami florida"
let bing_query = HttpUtility.UrlEncode(original_query)
let url = "http://www.bing.com/search?first=0&q=" + bing_query
let content = http_sync (Uri url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment