#include #include #include #include #include "HttpTest.h" HttpTest::HttpTest(QObject *parent) : QObject(parent) { } void HttpTest::ExecuteConnection() { http = new QHttp(this); connect(http, SIGNAL(stateChanged(int)), this, SLOT(updateHttpStatus(int))); connect(http, SIGNAL(done(bool)), this, SLOT(httpDone(bool))); buffer = new QBuffer; buffer->open(QIODevice::ReadWrite); http->setHost("www.ptlug.org"); http->get("http://www.ptlug.org", buffer); } void HttpTest::updateHttpStatus(int status) { qDebug("Status: %d", status); if(status == 0) { QTextStream out(buffer); while(!out.atEnd()) { QString line = out.readLine(); qDebug("Data: %s", line); } } } void HttpTest::httpDone(bool error) { qDebug("Done!"); }