#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))); buf = new QBuffer; //buf->setTextModeEnabled(true); buf->open(QIODevice::ReadWrite); http->setHost("www.ptlug.org"); http->get("http://www.ptlug.org/sede.php", buf); } void HttpTest::updateHttpStatus(int status) { qDebug("Status: %d", status); if(status == QHttp::Unconnected) { //qDebug(http->readAll()); qDebug() << QString(buf->readAll()); } } void HttpTest::httpDone(bool error) { qDebug("Done!"); }