Search code examples
c#.netvbscriptscreen-scraping

How to screen scrape form results from a browser


I've have a client that is using a third party piece of web software. On 1 screen, my client fills out a form. Before submitting, he wants to run something that captures what he's entered in and inserts it into a csv or database. The CSV or database part is easy. Getting the data from a browser that is already started, running on another web server is the part I don't know how to do.

How can I capture the contents of the html form? I would prefer to use c#, vb.net, vbs or similar but really am interested in anything. I would also prefer not to install custom software on the client workstation except what screen scraping software I write here. I would also prefer for the user to fill out the form and they run my script to gather the data rather than having to run a custom browser instance.

Thanks!


Solution

  • I decided to use javascript and add a IE favorite or a firefox book mark that achieves this. It retrieves the data from the form, sends the data to an aspx page from the query string. The aspx page then writes the data to the database and displays a pop-up graphic if the write was successful or not.

    Here's a sample of the script:

    javascript:var oForm = document.forms[0];var name = oForm.elements["name"].value; void window.open("http://www.mydomain.com/page.aspx?data=" + name ,"_blank","resizable,height=130,width=130");
    

    Everyone, thanks for the suggestions!!