Imports:
Imports System.IO
Imports System.Net
Imports System.Web
Public Function GetPostcodeDistance( _
ByVal startPostcode As String, _
ByVal endPostcode As String _
) As String
Const siteUrl As String = "http://www.dfes.gov.uk/cgi-bin/inyourarea/dist.pl"
Dim webReq As HttpWebRequest
Dim webResp As WebResponse
Dim reqStm As StreamWriter
Dim respStm As StreamReader
Dim postData As String
Create web request
webReq = DirectCast(WebRequest.Create(siteUrl), HttpWebRequest)
webReq.Method = "POST"
reqStm = New StreamWriter(webReq.GetRequestStream())
Write post data to the stream
postData = "postcode1=" & HttpUtility.UrlEncode(startPostcode)
postData &= "&postcode2=" & HttpUtility.UrlEncode(endPostcode)
reqStm.Write(postData)
Send request and get response
webResp = webReq.GetResponse()
Read from stream
respStm = New StreamReader(webResp.GetResponseStream())
Parse HTML here
End Function