How to use QWebEngine to intercept HTML get the post data?

  • In QtWebKit we can use QNetworkAccessManager, like:```
    class NetworkAccessManager : public QNetworkAccessManager
    explicit NetworkAccessManager(QNetworkAccessManager *manager, QObject *parent);
    QNetworkReply * createRequest(QNetworkAccessManager::Operation operation,const QNetworkRequest &request, QIODevice *device);

    We can implement QNetworkReply * createRequest(). In this method we can get:
    operation (QNetworkAccessManager::Operation operation)
    request (const QNetworkRequest &request)
    post data (QIODevice *device)
    From request we can get the url, from post data  we can get  data from html (maybe other operation also have this data).
    In QtWebEngine we can use QWebEngineUrlRequestInterceptor to get operation and url, like:```
    class WebUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
        WebUrlRequestInterceptor(QObject *p = Q_NULLPTR);
        void interceptRequest(QWebEngineUrlRequestInfo &info);

    We can implement interceptRequest(QWebEngineUrlRequestInfo &info), in this method we have info, from info we can get
    operation (info.requestMethod)
    url (info.requestUrl)
    Now I want to get post data, how can I get it?
    help!!!!! thank you

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.