All pastes #609195 Raw Edit

QHttp

public cpp v1 · immutable
·published 2007-07-08 19:00 UTC
rendered paste body
#include <QtCore>#include <QtNetwork>#include <QBuffer>#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!");}