Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. void ApplicationUI::getHTMLInfo()
  2. {
  3. QNetworkAccessManager *mgr = new QNetworkAccessManager(this);
  4. QObject::connect(mgr,
  5. SIGNAL(finished(QNetworkReply*)),
  6. this,
  7. SLOT(processHTMLPage(QNetworkReply*)));
  8. QNetworkRequest request = QNetworkRequest();
  9. request.setUrl(QUrl(myURL));
  10. qDebug() << "Getting the following URL: " << myURL;
  11. mgr -> get(request);
  12. }
  13. void ApplicationUI::processHTMLPage(QNetworkReply* reply)
  14. {
  15. qDebug() << "ProcessHTMLPage method has run";
  16. QByteArray payload = reply->readAll();
  17. qDebug() << "size of payload is: " << payload.size();
  18. QString str = QString::fromUtf8(payload.data(), payload.size());
  19. qDebug() << str;
  20.  
  21.  
  22.  
  23. reply -> deleteLater();
  24. }
  25.  
  26. ============================
  27. RESULTS
  28. ============================
  29.  
  30. Getting the following URL: "http://t.co/zJcHz6y4ve"
  31. ProcessHTMLPage method has run
  32. size of payload is: 0
  33. ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement