Jump to content
  • Advertisement
Sign in to follow this  
Belgium

c++ sending keypresses to website

This topic is 3661 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

To assist me with my job I wrote a c++ program which goes to several company webpages and copies the information there. I'm using wininet.h to do this. Recently, the webpages have become password protected. I can't figure out how enter the username, password and press the "login" button from within the program. Does anyone have some tips for me? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Is there a particular reason why you programmed this in C++? A less wordy language like Perl or Ruby, Python, PHP, ... would probably more productive...

Well, to login you basically need to read the source code of the web page and figure out the fields which you need to fill out and submit. A tool such as Fiddler from Microsoft can help you with this.

If you really need to login over HTTP(S) with C++, you need to read up on the topic and then submit the proper information. Google for C++ HTTP SSL library or some such.

If you rewrote the program in one of the aforementioned languages, there are many libraries in any of these languages for HTTP which make logging in (also over SSL) a painless and straightforward task.

Share this post


Link to post
Share on other sites
Quote:
Original post by Konfusius
Is there a particular reason why you programmed this in C++? A less wordy language like Perl or Ruby, Python, PHP, ... would probably more productive...


I used C++ because it is what I am familiar with. I'm not a programmer by trade. The program I wrote is used to automate a process for myself and co-workers. While those languages you mentioned may be better I really don't have the luxury of learning them at the moment. So, I'm continuing with what I know and what is working (that is, except for the inability to extract the information to be parsed and analyzed...)

Quote:
Original post by Konfusius
Well, to login you basically need to read the source code of the web page and figure out the fields which you need to fill out and submit. A tool such as Fiddler from Microsoft can help you with this.


Thanks. I've briefly looked into it and it looks very interesting. I'll download it soon and see what I can learn from fiddling with it.

Quote:
Original post by Konfusius
If you really need to login over HTTP(S) with C++, you need to read up on the topic and then submit the proper information. Google for C++ HTTP SSL library or some such.


I had attempted some google research but "HTTP" alone comes up with all kinds of non-applicable pages.

Quote:
Original post by Konfusius
If you rewrote the program in one of the aforementioned languages, there are many libraries in any of these languages for HTTP which make logging in (also over SSL) a painless and straightforward task.


One day, in my spare time, I'll have to look into one of the aforementioned languages. As to rewriting the program in one of those languages, that might not be a very easy task. The program does more than scrape a few webpages. It parses that data, thinks about the meaning of life the universe and everything, and then recommends actions based on the parsed data.

Share this post


Link to post
Share on other sites
Look into InternetExplorer objects in VBScript.

Example:


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.Silent = True
IE.Navigate "http://www.google.com"

Do While IE.Busy
Loop

IE.Document.f.q.Value = "gamedev"
IE.Document.f.submit()

Do While IE.Busy
Loop

IE.Visible = True


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!