Hello!

I want to create a http connection to a webserver and start downloading data in a QThread, but I'm having some problems.

First, my code is returning usually nothing from my searches:

Qt Code:
  1. HTTPClass::HTTPClass(QObject *parent) :
  2. QObject(parent)
  3. {
  4. namConnection = new QNetworkAccessManager(this);
  5.  
  6. connect(namConnection, SIGNAL(finished(QNetworkReply*)),
  7. this, SLOT(slotReplyFinished(QNetworkReply*)));
  8. connect(namConnection, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
  9. this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
  10. connect(namConnection, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
  11. this, SLOT(slotProxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
  12. connect(namConnection, SIGNAL(networkSessionConnected()),
  13. this, SLOT(slotNetworkSessionConnected()));
  14.  
  15. QNetworkRequest request;
  16. request.setUrl(QUrl("http://en.wikipedia.org/wiki/Main_Page"));
  17.  
  18. reply = namConnection->get(request);
  19. connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
  20. connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
  21. this, SLOT(slotError(QNetworkReply::NetworkError)));
  22. connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
  23. this, SLOT(slotSslErrors(QList<QSslError>)));
  24. }
  25.  
  26. void HTTPClass::setConnectionData()
  27. {
  28.  
  29. }
  30.  
  31. void HTTPClass::slotReplyFinished(QNetworkReply *reply)
  32. {
  33. qDebug() << reply->readAll();
  34.  
  35. reply->deleteLater();
  36. }
  37.  
  38. void HTTPClass::slotAuthenticationRequired(QNetworkReply *reply, QAuthenticator *aut)
  39. {
  40. qDebug() << "Ha";
  41. //aut->setUser("Username");
  42. //aut->setPassword("Password");
  43. }
  44.  
  45. void HTTPClass::slotProxyAuthenticationRequired(QNetworkProxy proxy, QAuthenticator *aut)
  46. {
  47.  
  48. }
  49.  
  50. void HTTPClass::slotNetworkSessionConnected()
  51. {
  52. qDebug() << "Connected";
  53. }
  54.  
  55. void HTTPClass::slotReadyRead()
  56. {
  57. reply->readAll();
  58. }
  59.  
  60. void HTTPClass::slotError(QNetworkReply::NetworkError error)
  61. {
  62. qDebug() << QString::number(error);
  63. }
  64.  
  65. void HTTPClass::slotSslErrors(QList<QSslError> errors)
  66. {
  67. qDebug() << errors[0].errorString();
  68. }
To copy to clipboard, switch view to plain text mode 

Everything I get is 3 blanck answers. ("" "" "") What am I doing wrong? I know how to download a file from the web, but not how to read data from a url.

--
My second question: actually I don't know how the information is in the link I actually want to connect with. It must be some kind of server, but not if its an sql server with MySQL or FTP something else. How could I know how the information is stored in the link I want to connect with? (which by the way: sharkbuss.banifinvest.com.br , gate 80, parameter: /BI3S2/get.aspx)
--
My third question: in order to connect myself with this link, I now I'll have to give a password and username. Where exactly in my code should I put this part?


Thanks,

Momergil