By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,260 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,260 IT Pros & Developers. It's quick & easy.

Can you 'post' a web form from a stand-alone application.

P: n/a
KC
I want to submit an HTTP request to a site but the site needs to think it's
being POSTed from a form. How do I do that?

--

--------
Ken Hunt
678-644-6036
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Imports System.Net

Module Module1

Sub Main()
Dim request As HttpWebRequest =
HttpWebRequest.Create("http://www.google.com")
Dim response As HttpWebResponse
Dim postData As String = "q" & ChrW(61) & "Sample Criteria"
Dim bytes As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(postData)
Dim output As IO.Stream

request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = postData.Length

output = request.GetRequestStream()
output.Write(bytes, 0, bytes.Length)
output.Close()

End Sub

End Module
"KC" <yo*@dontneed.this> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
I want to submit an HTTP request to a site but the site needs to think it's
being POSTed from a form. How do I do that?

--

--------
Ken Hunt
678-644-6036

Nov 20 '05 #2

P: n/a
KC
Many thanks!

Ken

P.S. I'm still in the beat-your-head-against-the-wall-to-do-simple-things
stage.
"Mythran" <ki********@hotmail.com> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
Imports System.Net

Module Module1

Sub Main()
Dim request As HttpWebRequest =
HttpWebRequest.Create("http://www.google.com")
Dim response As HttpWebResponse
Dim postData As String = "q" & ChrW(61) & "Sample Criteria"
Dim bytes As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(postData) Dim output As IO.Stream

request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = postData.Length

output = request.GetRequestStream()
output.Write(bytes, 0, bytes.Length)
output.Close()

End Sub

End Module
"KC" <yo*@dontneed.this> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
I want to submit an HTTP request to a site but the site needs to think it's being POSTed from a form. How do I do that?

--

--------
Ken Hunt
678-644-6036


Nov 20 '05 #3

P: n/a
"KC" <yo*@dontneed.this> wrote in news:O3**************@TK2MSFTNGP10.phx.gbl:
I want to submit an HTTP request to a site but the site needs to think it's
being POSTed from a form. How do I do that?


http://www.indyproject.org/

www.atozed.com/indy has an HTTP demo. It shows GET, but POST is just another
method with similar arguments.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.