[Qt-interest] How to send a query parameter to QHTTP?

Lingfa Yang lingfa at brandeis.edu
Mon May 18 18:02:54 CEST 2009


Hi,

A quick question: When I have a url with a query parameter following a 
'?' character, how to send out the query?

For example, here is yahoo finance for Dow:
    QUrl url("http://finance.yahoo.com/q?s=^DJI");

    QHttp *http = new QHttp(this);
    connect(http, SIGNAL(requestFinished(int, bool)),
            this, SLOT(httpRequestFinished(int, bool)));
    connect(http, SIGNAL(dataReadProgress(int, int)),
            this, SLOT(updateDataReadProgress(int, int)));
...

http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());

After setting the host name, then, how to send out the query, "s=^DJI", 
means Dow Jones Industrial Average?
Without the query parameter, it is a dummy page.

Thanks
Lingfa



More information about the Qt-interest-old mailing list