Created
June 8, 2010 21:04
-
-
Save willf/430657 to your computer and use it in GitHub Desktop.
Do a synchronous http request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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