At the hands of a book is QT4 GUI programming in C ++. I read and write the web page parser. It says about QHttp, QtCreator does not find this class in me ...

It also wonders how you can send a request to the site, get a ping from it - whether it works or an error code.

And also, how to copy the “skeleton” of the site into a spooled file for subsequent operations on it.

UPD

I read that using QHttp in our century is not comme il faut, and QNetworkAccessManager should be used. (I doubt about the latter)

    1 answer 1

    Yes, nowadays it is recommended to use QNetworkAccessManager - he knows how to make requests, parallelize and other buns.

    The most minimal example ( taken here ):

    QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); manager->get(QNetworkRequest(QUrl("http://qt-project.org"))); 

    The first line created a manager (he needed one for the whole project). The second line connected the signal about the completion of the request with the slot (this line is also usually one for the whole project). And the third is actually a request. In the replyFinished slot, a replyFinished arrives that is contained in QNetworkReply. This object has a readAll method that allows you to get an answer, somewhere like that.

     QByteArray data=reply->readAll(); 

    this object also contains a link to the original request, so you can find out the url where the request was.

    In general, I recommend starting with the study of this example .

    In this task, there is one more thing that many people stumble upon and cannot understand - everything seems to have been added to include, but qt creator / qmake does not see it. But this is simply solved - you need to open the project file (with the pro extension) and add such a line (somewhere above, there will be similar lines).

     QT += network 

    Ping can be sent to the site, but I do not see much point in this. But if you really, really want, then of course you can. SO is an example.