#ifndef STAT_H
#define STAT_H
#include <QtNetwork>
#include <QtGui>
#include "ui_stat.h"
class Stat
: public QDialog,
public Ui
::dialog{
Q_OBJECT
public:
{
setupUi ( this );
connect (&http, SIGNAL( requestFinished(int,bool)),this,SLOT(end()));
connect ( statButton, SIGNAL ( clicked ( ) ), this, SLOT ( send ( ) ) );
http.
setHost ( host,
QHttp::ConnectionModeHttps );
}
{
data.append ( "FindUserName=");
data.append (input1);
data.append ( "&FindUserPass=");
data.append ( input2 );
outFile .setFileName ( "out.html" );
QSslSocket *socket = new QSslSocket;
socket->connectToHostEncrypted ( "stat.ultranet.ru", 443 );
if ( socket->waitForEncrypted ( 5000) )
{
http.setSocket ( socket );
header.setValue ( "Content-Type", "application/x-www-form-urlencoded" );
header.setValue ( "Host", "stat.ultranet.ru" );
http.request ( header, data, &outFile );
}
}
public slots:
void end( )
{
outFile.close ( );
emit done();
}
void send ( )
{
sendData ( loginLineEdit ->text( ), passwLineEdit ->text( ) ) ;
}
signals:
void done( );
private:
};
#endif
#ifndef STAT_H
#define STAT_H
#include <QtNetwork>
#include <QtGui>
#include "ui_stat.h"
class Stat : public QDialog, public Ui::dialog
{
Q_OBJECT
public:
Stat (const QString &host)
{
setupUi ( this );
connect (&http, SIGNAL( requestFinished(int,bool)),this,SLOT(end()));
connect ( statButton, SIGNAL ( clicked ( ) ), this, SLOT ( send ( ) ) );
http.setHost ( host, QHttp::ConnectionModeHttps );
}
void sendData (const QString &input1, const QString &input2 )
{
data.append ( "FindUserName=");
data.append (input1);
data.append ( "&FindUserPass=");
data.append ( input2 );
outFile .setFileName ( "out.html" );
outFile.open (QIODevice:: WriteOnly | QIODevice::Truncate);
QSslSocket *socket = new QSslSocket;
socket->connectToHostEncrypted ( "stat.ultranet.ru", 443 );
if ( socket->waitForEncrypted ( 5000) )
{
http.setSocket ( socket );
QHttpRequestHeader header ( "POST", "/index.php" );
header.setValue ( "Content-Type", "application/x-www-form-urlencoded" );
header.setValue ( "Host", "stat.ultranet.ru" );
http.request ( header, data, &outFile );
}
}
public slots:
void end( )
{
outFile.close ( );
emit done();
}
void send ( )
{
sendData ( loginLineEdit ->text( ), passwLineEdit ->text( ) ) ;
}
signals:
void done( );
private:
QFile outFile;
QHttp http;
QByteArray data;
};
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks