void MainWindow::on_pb_getIMDB_clicked()
{
httpRequestAborted = false;
header.setValue("Host", "german.imdb.com");
header.setValue("User-Agent", "Mozilla/5.0 (X11; U; LinuMozx i686; de; rv:1.9.0.1) Gecko/2008070400 SUSE/3.0.1-8.1 Firefox/3.0.1");
header.setValue("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
header.setValue("Accept-Language", "de-ch,de;q=0.8,de-de;q=0.6,en-us;q=0.4,en;q=0.2");
header.setValue("Accept-Encoding", "gzip,deflate");
header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
header.setValue("Keep-Alive", "300");
header.setValue("Connection", "keep-alive");
http->setHost( "german.imdb.com" );
httpGetId = http->request( header );
}
void MainWindow::httpRequestFinished( int requestId, bool error )
{
if (requestId != httpGetId)
return;
if ( error )
{
tr( "Download failed: %1." )
.arg( http->errorString() ));
}
else
{
qDebug
() <<
QString::number( m_data.
size() );
te_test->setText( text );
}
}
void MainWindow::on_pb_getIMDB_clicked()
{
httpRequestAborted = false;
QHttpRequestHeader header("GET", "/find?s=all&q=300&x=15&y=7 HTTP/1.1");
header.setValue("Host", "german.imdb.com");
header.setValue("User-Agent", "Mozilla/5.0 (X11; U; LinuMozx i686; de; rv:1.9.0.1) Gecko/2008070400 SUSE/3.0.1-8.1 Firefox/3.0.1");
header.setValue("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
header.setValue("Accept-Language", "de-ch,de;q=0.8,de-de;q=0.6,en-us;q=0.4,en;q=0.2");
header.setValue("Accept-Encoding", "gzip,deflate");
header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
header.setValue("Keep-Alive", "300");
header.setValue("Connection", "keep-alive");
http->setHost( "german.imdb.com" );
httpGetId = http->request( header );
}
void MainWindow::httpRequestFinished( int requestId, bool error )
{
if (requestId != httpGetId)
return;
if ( error )
{
QMessageBox::information( this, tr( "HTTP" ),
tr( "Download failed: %1." )
.arg( http->errorString() ));
}
else
{
QByteArray m_data = http->readAll();
qDebug() << QString::number( m_data.size() );
QString text(m_data.data());
te_test->setText( text );
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks