尝试发布请求时找不到404页面

时间:2013-05-10 18:34:23

标签: c++ qt http post

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找不到页面

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

0 个答案:

没有答案