• 5833阅读
  • 0回复

QHttp下载网页的问题 [复制链接]

上一主题 下一主题
离线fengtian
 
只看楼主 正序阅读 楼主  发表于: 2007-06-11
— 本帖被 XChinux 从 General Qt Programming 移动到本区(2011-01-02) —
我的情况:
使用QHTTP下载没有参数的动态网页OK   比如:http://www.a2gold.com/index_en.php
但是下载有参数的动态网页就下不料     比如:http://feymercurial.com/forum/profil...wprofile&u=873

我的代码:

int main(int argc,char *argv[])
{
    QApplication qapp(argc,argv);

    QHttp *http;http=new QHttp();
    //QUrl *url=new QUrl("http://feymercurial.com/forum/profile.php?mode=viewprofile&u=873");          //这个下不了
    QUrl *url=new QUrl("http://www.a2gold.com/index_en.php");       //这个可以下

    QFileInfo fileinfo(url->path()); 
    QFile *file = new QFile(fileinfo.fileName());
    file->open(QIODevice::WriteOnly); http->setHost(url->host(),80);
    int httpGetId=http->get(url->path(),file);qDebug() << httpGetId;

    return qapp.exec();
}



请问如何才能下载带有参数的网页   比如http://feymercurial.com/forum/profile.php?mode=viewprofile&u=873
[ 此贴被XChinux在2008-07-18 14:45重新编辑 ]
快速回复
限100 字节
 
上一个 下一个