[Qt-interest] Get http response
Meir Yanovich
meiry242 at gmail.com
Sun Mar 21 09:25:11 CET 2010
Hello all im beginner with QtWebKit i build simple web frame that loaded
page ( server side )
and when from this page i submit data i like to catch the response string
from the server in the c++ side how can i do that ?
i have this code and it dosn't work , what im doing wrong here :
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
browser = new QWebView();
connect(browser->page(),
SIGNAL(startRequested(QNetworkRequest)),
this, SLOT(startRequested(QNetworkRequest)));
m_manager = new QNetworkAccessManager( this );
connect(m_manager, SIGNAL(finished(QNetworkReply*)),this,
SLOT(replyFinished(QNetworkReply *)) );
browser->load(QUrl("http://www.cnn.com"));
}
void MainWindow::replyFinished( QNetworkReply *reply )
{
if ( reply->error() != QNetworkReply::NoError ) {
qDebug() << "Request failed, " << reply->errorString();
return;
}
qDebug() << "Request succeeded";
}
void MainWindow::startRequested(const QNetworkRequest &request)
{
QString defaultFileName =
QFileInfo(request.url().toString()).fileName();
if (defaultFileName.isEmpty())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100321/410e0b70/attachment.html
More information about the Qt-interest-old
mailing list