Jump to content

WebUi, Get request in Qt


horse315

Recommended Posts

I can't find out why my request fails.

(sorry some thing like port you can meet twice)) i didn't know what to to))))

so:

connecter.h

#include <QtGui>
#include <QtNetwork>
#include <QDebug>
#include <QAuthenticator>

class connecter: public QWidget
{
Q_OBJECT
private:
QHttp ht;
QHttpRequestHeader Header;
QAuthenticator Auth;
public:
connecter(QWidget *parent = 0);
public slots:
void smthDone(int, bool);
};

connecter.cpp

#include "connecter.h"

connecter::connecter(QWidget *parent):QWidget(parent)
{

connect(&ht, SIGNAL(requestFinished(int, bool)),this, SLOT(smthDone(int, bool)));
ht.setUser("horse315","horsesbook"); // set name pass

ht.setHost("192.168.1.2", QHttp::ConnectionModeHttp, quint16(7777));
qDebug() << ht.get(QUrl::toPercentEncoding("http://192.168.1.2:7777/gui/?list=1")); //!! GET REQUEST
}

void connecter::smthDone(int i, bool pp){ // it happens when request is finished
qDebug() << "Ok";
qDebug() << ht.readAll(); // displays in debug terminal the reply

}

It returns "invalid request"...

same thing i recieve in telnet making GET reques manualy.

But in Fx or "wget http://horse315:horsesbook@192.168.1.2:7777/gui/?list=1"

returns me right text.

Help me please

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...