1
QUrl url("http://www.site.org/index/process");
    QNetworkRequest nreq = QNetworkRequest(url);

    nreq.setRawHeader("User-Agent","Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefox/20.0");
    nreq.setRawHeader("Accept","*/*");
    nreq.setRawHeader("Accept-Language","ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3");
    //nreq.setRawHeader("Accept-Encoding","gzip, deflate");
    nreq.setRawHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
    nreq.setRawHeader("X-Requested-With","XMLHttpRequest");
    nreq.setRawHeader("Referer","http://site.org/");
    nreq.setRawHeader("Connection","keep-alive");
    nreq.setRawHeader("Pragma","no-cache");
    nreq.setRawHeader("Cache-Control","no-cache");


    QByteArray bArr;
    bArr="value=1&operation=2";


    QNetworkReply *reply = request->post(nreq,bArr);

当我运行此代码时,我得到

404页面不存在

答案,但在浏览器中一切正常。有什么问题?

4

0 回答 0