This is my improve code:
MainWindow
::MainWindow(QWidget *parent
){
ui->setupUi(this);
http
= new QHttp("appmsg.gadu-gadu.pl");
QHttpRequestHeader dataRequest
("GET",
QUrl::toPercentEncoding("/appsvc/appmsg4.asp?fmnumber=1247818&version=7,0,0,20&lastmsg=1"));
dataRequest.setValue("Accept-Language", "pl");
dataRequest.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
dataRequest.setValue("Pragma", "no-cache");
dataRequest.setValue("Host", "appmsg.gadu-gadu.pl");
http->request(dataRequest);
QObject::connect(http,
SIGNAL(requestFinished
(int,
bool)),
this,
SLOT(function
(int,
bool)));
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
http = new QHttp("appmsg.gadu-gadu.pl");
QHttpRequestHeader dataRequest("GET", QUrl::toPercentEncoding("/appsvc/appmsg4.asp?fmnumber=1247818&version=7,0,0,20&lastmsg=1"));
dataRequest.setValue("Accept-Language", "pl");
dataRequest.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
dataRequest.setValue("Pragma", "no-cache");
dataRequest.setValue("Host", "appmsg.gadu-gadu.pl");
http->request(dataRequest);
QObject::connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(function(int, bool)));
}
To copy to clipboard, switch view to plain text mode
void MainWindow::function(int id, bool error){
qDebug() << "Test";
if(error){
qDebug() << http->errorString();
return;
}
QString dataResult
= http
->readAll
();
qDebug() << dataResult;
}
void MainWindow::function(int id, bool error){
qDebug() << "Test";
if(error){
qDebug() << http->errorString();
return;
}
QString dataResult = http->readAll();
qDebug() << dataResult;
}
To copy to clipboard, switch view to plain text mode
Output return:
Starting C:/Documents and Settings/Trok/Pulpit/Qt Progs/Test_gg/debug/Test_gg.exe...
NOD32 protected [MSAFD Tcpip [TCP/IP]]NOD32 protected [MSAFD Tcpip [UDP/IP]]NOD32 protected [MSAFD Tcpip [RAW/IP]]NOD32 protected [RSVP UDP Service Provider]NOD32 protected [RSVP TCP Service Provider]Test
""
Starting C:/Documents and Settings/Trok/Pulpit/Qt Progs/Test_gg/debug/Test_gg.exe...
NOD32 protected [MSAFD Tcpip [TCP/IP]]NOD32 protected [MSAFD Tcpip [UDP/IP]]NOD32 protected [MSAFD Tcpip [RAW/IP]]NOD32 protected [RSVP UDP Service Provider]NOD32 protected [RSVP TCP Service Provider]Test
""
To copy to clipboard, switch view to plain text mode
What's wrong else?
Bookmarks