C++ (Qt)connect(pmanager, SIGNAL(finished(QNetworkReply *)), SLOT(httpFinished(QNetworkReply *)));for(int n = 1;n<30; n++){ pmanager->get(QNetworkRequest(QUrl("http://host.ru/file"+QString::number(n)+".html")));} ... void MyClass::httpFinished(QNetworkReply *reply){ QString fileName = reply->url().toString(); fileName.remove(0, fileName.lastIndexOf('/') + 1); // оставить только имя файла QFile file(fileName); if (file.open(QIODevice::WriteOnly)) { file.write(reply->readAll()); file.flush(); file.close(); } reply->deleteLater(); reply = 0; qDebug("file '%s' downloaded", qPrintable(fileName));}
C++ (Qt)for(int n = 1;n<30; n++) { QNetworkReply *reply = pmanager->get(QNetworkRequest(QUrl("http://journal.j-art.ru/p/data/nomer"+QString::number(i)+"/"+QString::number(n)+".html"))); connect( reply, SIGNAL(readyRead()), SLOT(readData()) ); }