What is a simple way to complete a php form, submit it and get the resulting data ? It doesn't have to be C++ but I know it best, I have the last visual studio and I need a windows executable.
I found something that does this in ruby, it's called mechanize, I'm wondering if there's something similar for C++ ?
If it's a general form (i.e. you want it to work well with any HTML form, then probably your best bet is to utilize an HTML parsing library, such as http://www.codeproject.com/KB/library/GomzyHTMLReader.aspx. What you'll probably want to do is have the parsing algorithm parse the HTML document, find all of the inputs that are expected, then craft an HTTP request with the responses (see How do you make a HTTP request with C++?).
There are probably a few things that you'll need from the HTML form:
- The action to take after form submission (from the tag's action attribute).
- The method (GET or POST). If it's GET, then your work will probably be simple, as you'll be able to simply add it to the URI as parameters. If it's POST, it'll be a little more difficult, but not incredibly so.
- Whether or not the connection is SSL encrypted.
I'll be honest with you, some forms are going to be very difficult to automatically enter. Many web sites specifically discourage this type of behavior, so unless it's something you've specifically crafted, or that is designed to be filled out automatically, it could be pretty tough.