0

Possible Duplicate:
How do you programmatically fill in a form and 'POST' a web page?

I've been looking for a way to allow a user to submit a form using C# or even HTML,so I get the source code, save it in a file and get the name of the text fields in order to submit the form.

for example logging with ur email to Facebook, gmail,stackoverflow ... or any page containing a form.

Before I ask how,is it possible? My project is mainly to help visually impaired people surf the web easier! like get any html source code and be able to re-arrange the tags, omit images and such tags that won't benefit them,and try to give them the ability to log in using speech to text ...so my code will take the speech convert it to text field by field and submit the form when he/she's done! of course the name of the fields will be spoken using text to speech!

Thanks in advance

Community
  • 1
  • 1
dimazaid
  • 1,673
  • 3
  • 22
  • 24
  • 1
    Of course it's possible, but you need to supply a great deal more information about the environment you want to do it in, and what exactly you are trying to accomplish (obviously, submitting the form is a step in doing something larger, tell us what that is, because it's likely there's a better way to do it than what you think) – Erik Funkenbusch Sep 21 '11 at 17:08
  • Thanks..Editing in process :) – dimazaid Sep 21 '11 at 17:09
  • Question is not clear. Do you want to hook into the browser at the point, when a user enters this data, intercept it, save it to the file and them allow the data to be actually submitted to a site? – Maxim V. Pavlov Sep 21 '11 at 17:10
  • 1
    Find all of the "name" attributes of the fields, combine with the values entered by the user and issue a POST request to the server? What exactly are you trying to do? – Pierreten Sep 21 '11 at 17:10

1 Answers1

2

Have you looked at the WebBrowser control? http://msdn.microsoft.com/en-us/library/aa752041(v=vs.85).aspx

It will allow you to automate surfing. You'll also be able to interact with the pages and modify values in text boxes, click buttons, submit forms.

Here's some talk about how to handle clicking. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/2eed72f7-4fde-4730-abf7-738e9b6e87c4/

I've used that approach successfully in the past, but I will say it's problematic if you don't/can't control the website. If I write a program that will automate logging into facebook with this method it would require me telling it what URL to visit, what textboxes to fill, and what form name or button name to click.

If Facebook redesigns their layout - my code may no longer work.

If you are just interested in the logging in part; you might want to take a look at browser addons (I don't know if this will help at all, but I thought I would mention it). I use a product called, 'LastPass' (https://lastpass.com/) and it manages all of my user names and passwords. If I visit a site it is familiar with, it can automatically fill in the forms for me, allowing me to log in or completely enter my address.

Rob P.
  • 14,921
  • 14
  • 73
  • 109