Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Handling http request in qt app



  • Dear Genius,

    I need to capture from the input data of html application from my qt application. If I don't use web socket and Qtcpsocket, is there any way to get the data from my qt app?

    I want my application to be like web server.
    Thanks in advance.



  • @natalieong said in Getting data from the html page in application:

    I need to capture from the input data of html application from my qt application.

    What exactly are you trying to do?

    be like web server

    The web server functionality of Qt is still in the prototype stage so if that's what you need you will have to use a 3rd party app



  • @VRonin Thanks for the reply. Basically, my qt app needs to handle the http request . Html page will try to connect to my qt app and it will send some data (json or xml). I need to parse those data and needs to do some processing.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    So your application is a web server that is going to be called from some foreign site ?

    Maybe the Cutelyst project could be of use.



  • @SGaist said in Handling http request in qt app:

    foreign

    Thank for the reply. Basically, I have the html application for frontend and c++ for backend. Backend needs to get the data from html when the user click the button using http protocols.
    I could send a request to a server and receive a reply using QNetworkAccessManager.
    What I need is something like a socket that, when a request comes in, produces an object
    where I can pick url of this request, so I can process and send out an appropriate reply.

    Am I just blind or is nothing like this in the Qt framework? If so, can you recommend alternatives?
    There is the QhttpServer : https://github.com/nikhilm/qhttpserver and is it suitable for my case?

    Thanks in advance.


  • Lifetime Qt Champion

    Can you explain what you mean by backend ?

    In any case, you need something to send your front end to your client, so what are you using currently ?

    As for the communication, are you thinking of something like QWebSocket ?



  • @SGaist , Sorry to confused you, the backend application is going to be called from some foreign site. The backend application needs to handle the http request from this foreign site(html). So, server and client is in different location. My question is that what is the best way of communication to handle http request from html page to c++? Thank you so much.


  • Lifetime Qt Champion

    Well, like I already suggested cutelyst is likely what you want. It's a C++ WebServer that allows you to also directly work with Qt.


Log in to reply