473,395 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
3 952
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Pautler | last post by:
I'm creating a web-based authoring tool where one form encompasses several sections for editing. I'd like each section to have its own reset button, so that use of that button affects only that...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
10
by: Danny | last post by:
Hi all, I am having some odd problems with AJAX on Firefox (1.5). When I use GET as the request method everything works ok, but when I do a POST the remote function doesn't get the parameters I...
5
by: Jay | last post by:
Hi, Does anyone know if you can do an HTML POST to a plain html file using javascript to receive and parse the parameters, instead of using asp, php, or a plain-old cgi program? Thanks, Jay
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
8
by: Mr. SweatyFinger | last post by:
where have they all gone. alt.suicide? alt.findContol.then.slit.your.own.throat?
6
by: trbjr | last post by:
Hello experts, I want to describe a project design and then ask some questions at the end. There is no code in this discussion, just symbols to illustrate an idea. Let S stand for a screen...
224
by: Jon Slaughter | last post by:
Sorry for all the cross posting but I'm interesting in getting a serious discussion about how usenet has become lately. Many people are moving away from usenet because of all the spam and cooks...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
3
by: Michiel Rapati-Kekkonen | last post by:
I have a continuous form, with 22 rows on display. I make a change in some row and have the form requeried. (I have to, because the query on which the form is based is not updateable, and the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.