CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2003
    Posts
    35

    detect and fill editboxes in Internet Explorer automatically

    hi,
    i have a MFC dialog application and i have to go to a predefined website (say, www.codeguru.com) with Internet Explorer, detect the log in editboxes, and automatically fill them up with details from my application.

    anyone has any idea how this can be done?

    thanks!
    -ashrobo

    edited to add: just realised there are many automated form filler out there. anyone has experienced writing those applications?
    Last edited by ashrobo; April 14th, 2004 at 10:19 AM.

  2. #2
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    Are you referring to sending a http form to a http server? Other launching IE and fill up the form before sending, you can write code to open a socket and send a http 'POST' request directly to the server.

  3. #3
    Join Date
    Dec 2003
    Posts
    35
    Originally posted by Kheun
    Are you referring to sending a http form to a http server? Other launching IE and fill up the form before sending, you can write code to open a socket and send a http 'POST' request directly to the server.
    i haven't thought of it as "sending a http form to a http server" actually, what i had been thinking was just "mimicking the steps that a user will take to log in to a website, say this forum" - i.e. to open up internet explorer, type the url in the bar, fill in the 2 editboxes, and click enter.

    hope you can elaborate more.. (=

    thanks!
    -ashrobo

  4. #4
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    Actually, sending http POST request directly to the server is quite common. There are many existing applications that allow user to register his/her copy using the same mechanism.

    The actual working is exactly like that of a webbrowser. That is, when the user clicks on submit, the webbrowser creates a http POST request and sends it to the server. So in your implementation you can also the same thing when all data is available to you. In fact, it is much simpler in implementation and you can capture the data in anyway you like without restricting yourself only to a webbrowser. For more details on the http and http POST protocol, you can search at http://www.w3.org/.

  5. #5
    Join Date
    Dec 2003
    Posts
    35
    actually, i dont quite get it.

    do you have a working example of some sort?

  6. #6
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    Let me try to phrase it differently. Probably, you have already known, the transport layer is TCP/IP which helps to send the bits for the data over the network. On top of the TCP/IP layer is HTTP. HTTP is an application layer protocol which is used for transfer the HTML file. If the web site is not available, it is also this protocol that tell your browser the error message, like 404 error. If everything works fine, then you can see the webpage, which is represented by HTML, on your browser. The HTTP also provide several other services and one of them is POST. Through the POST, we are enable to submit information on the HTML form to the designated server. Looking at your original workflow, it is exactly what you want to do right after mimicking the data entry by the user. Rather then mimicking, you can skip it and you go down to the HTTP layer for sending out the information directly.

    The code for the HTTP POST is pretty straigth forward. Unfortunately I don't have any available code at the moment. When implementing, you are require to open a TCP/IP socket connection, create the POST request in a buffer and then send it out to the server.

    Hope this helps.

  7. #7
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128

  8. #8
    Join Date
    Dec 2003
    Posts
    35
    Kheun, thanks for all the help.
    I guess I must be really dumb, I can't even figure out how to send data to the server through POST using the the sample.

  9. #9
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    Oops, a thousand apologies for giving the wrong direction... It is really my fault. As I was searching for it in a hurry, I didn't look at the code and it turn out to be using COM object... Sorry again.

    You may like to try your luck at www.codeproject.com. It has many sample codes that may be helpful.
    Last edited by Kheun; April 15th, 2004 at 05:29 AM.

  10. #10
    Join Date
    Dec 2003
    Posts
    35
    no worries. (=

    no one has tried this before?

    -ashrobo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured