PDA

View Full Version : QHttp get AND get field



TomASS
10th November 2009, 21:45
Hi!
I've a simple code to download "path" file to "file" on my disk.

QHttp *http = new QHttp(this);
connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool)));
QUrl url(StrUrl);
file = new QFile(fileName);
if (!file->open(QIODevice::WriteOnly)) {
qDebug() << "open file error";
delete file;
file = 0;
return;
}
QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
httpGetId = http->get(path, file);

If i write path like:

http://www.qtcentre.org/forum/newthread.php
i's doing right, but when I connect to get fields (ex. do=newthread&f=4) to string

http://www.qtcentre.org/forum/newthread.php?do=newthread&f=4
the get field is not pas :/

I'm using simple code in PHP to test

echo 'OK';
print_r($_REQUEST);

And I get empty $_REQUEST :/