Macok
24th July 2010, 12:39
I have a problem with a HTTP post method.
Here's an example:
Go to http://www.ddo.com/, type "BLABLA" in search area and press ENTER.
You will get "Total: 0 Results found for "BLABLA"".
I want to reach the same effect using Qt, I tried this:
void MainWindow::on_pushButton_clicked()
{
http=new QHttp("www.ddo.com");
connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponse(QHttpResponseHeader)));
http->post("/component/search/", "searchword=BLABLA");
}
void MainWindow::readResponse(QHttpResponseHeader header){
qDebug()<<http->readAll();
}
http->readAll() returns source code of site http://www.ddo.com/component/search/, but in source this expression:
Total: 0 Results found for "BLABLA"
doesn't exist. Instead, there's:
Total: 0 Results found for ""
So it looks like server didn't receive any post data.
I tried this on more websites, and every time server ignores my post data.
What's wrong?
Thanks in advance!
Here's an example:
Go to http://www.ddo.com/, type "BLABLA" in search area and press ENTER.
You will get "Total: 0 Results found for "BLABLA"".
I want to reach the same effect using Qt, I tried this:
void MainWindow::on_pushButton_clicked()
{
http=new QHttp("www.ddo.com");
connect(http, SIGNAL(readyRead(QHttpResponseHeader)), this, SLOT(readResponse(QHttpResponseHeader)));
http->post("/component/search/", "searchword=BLABLA");
}
void MainWindow::readResponse(QHttpResponseHeader header){
qDebug()<<http->readAll();
}
http->readAll() returns source code of site http://www.ddo.com/component/search/, but in source this expression:
Total: 0 Results found for "BLABLA"
doesn't exist. Instead, there's:
Total: 0 Results found for ""
So it looks like server didn't receive any post data.
I tried this on more websites, and every time server ignores my post data.
What's wrong?
Thanks in advance!