I had alot of trouble with this, but after looking at the google code and sniffing the HTTP Post with Wireshark i was able to obtain this- a good starting point (but I was getting 405 errors on some of my more complicated test forms.. not sure why)
Imports System.Web
Imports System.Net
Imports System.IO
Imports System.Text
Public Class Form1
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim address As Uri
Dim appId As String
Dim context As String
Dim query As String
Dim data As StringBuilder
Dim byteData() As Byte
Dim postStream As Stream = Nothing
''Dim myHttpUtility As HttpUtility
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
post()
End Sub
Sub post()
address = New Uri("http://googleform")
' Create the web request
request = DirectCast(WebRequest.Create(address), HttpWebRequest)
' Set type to POST
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
' Create the data we want to send
appId = "ss-form"
data = New StringBuilder()
data.Append("entry.0.single=" + HttpUtility.UrlEncode(BrandBox.Text))
data.Append("&entry.2.single=" + HttpUtility.UrlEncode(ModelBox.Text))
data.Append("&entry.3.single=" + HttpUtility.UrlEncode(ModelStringBox.Text))
' Create a byte array of the data we want to send
byteData = UTF8Encoding.UTF8.GetBytes(data.ToString())
' Set the content length in the request headers
request.ContentLength = byteData.Length
' Write data
Try
postStream = request.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
Finally
If Not postStream Is Nothing Then postStream.Close()
End Try
Try
' Get response
response = DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader = New StreamReader(response.GetResponseStream())
' Console application output
MessageBox.Show(reader.ReadToEnd())
Finally
If Not response Is Nothing Then response.Close()
End Try
End Sub
End Class
-d
www.chromableedstudios.com[
^]