G
Ghafran Abbas
To programmatically post form data to a web page and get the result in
..net, use the following code.
===========Begin Code================
Imports System.Net
Public Sub PostDataToForm()
'URL to post the data to
Dim strPostText As String = "http://www.google.com"
Dim myWebClient As New WebClient
Dim mypostvalues As New NameValueCollection
'Add Post Fields Here
'The first parameter is the name of the field, the second is the
value
mypostvalues.Add("hl", "en")
mypostvalues.Add("q", "test search")
Try
Dim responseData As Byte() = myWebClient.UploadValues(strPostText,
mypostvalues)
sResponse = Encoding.ASCII.GetString(responseData)
Catch
'Handle Error Here
Finally
myWebClient.Dispose()
End Try
End Function
===========End Code================
..net, use the following code.
===========Begin Code================
Imports System.Net
Public Sub PostDataToForm()
'URL to post the data to
Dim strPostText As String = "http://www.google.com"
Dim myWebClient As New WebClient
Dim mypostvalues As New NameValueCollection
'Add Post Fields Here
'The first parameter is the name of the field, the second is the
value
mypostvalues.Add("hl", "en")
mypostvalues.Add("q", "test search")
Try
Dim responseData As Byte() = myWebClient.UploadValues(strPostText,
mypostvalues)
sResponse = Encoding.ASCII.GetString(responseData)
Catch
'Handle Error Here
Finally
myWebClient.Dispose()
End Try
End Function
===========End Code================