Write simple web client for website
-
I want to try to write simple web client for one website. My client should be able to pass authorization (send data for two text fields), push simple buttons and click checkboxes on current page. I need not view page, go back/next or download something (so I do not want to create browser, only simple client, where I can hardcode urls). To be more common, I must understand how to parse page elements and create requents with actions I described above (also, if it requires authorization, should it somehow save session?).
I just started learn network modules in Qt, so I am quite confused with QWebEngine, QWebKit, QNetwork modules - what of them is most suitable for me? Any literature and examples are welcome. Thanks in advance.
-
Since you are starting to learn, your idea is to check how web requests work in Qt, just start using the QNetworkAccessManager. Look at the some examples in Qt installation example directory or google. It will give you idea about you can start accessing the web server.
-
Hi and welcome to devnet,
What is exactly the goal of your application ? Provide a webpage to discuss with the backend ? Do a full custom GUI ?
-
Something like https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-simplebrowser-example.html ?
so I am quite confused with QWebEngine, QWebKit, QNetwork modules - what of them is most suitable for me?
QtWebKit uses the same engine as apple's safari browser. the module has been discontinued since Qt 5.6
QtWebEngine uses the same engine as google chrome and is used to interact with webpages html and the likes.
QtNetwork is much more low level and is used to manage network communication. You can useQNetworkAccessManager
to interact with http but if you need to run html/css/javascript on webpages, you are in the wrong place -
@VRonin Now I am able to download page and read its headers. I see that page has html content-type ([Content-Type]: text/html; charset=utf-8), with some elements of which I should interact. Is it real with QNetwork tools?
I can parse requested pages myself, all what I need is to send data in some html elements on current page. -
Do you want to show these pages to the user ?