Results 1 to 3 of 3

Thread: Can't load HTML page with QNetworkReply

  1. #1
    Join Date
    Feb 2007
    Location
    Wroclaw, Poland
    Posts
    72
    Thanks
    6
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Can't load HTML page with QNetworkReply

    Hi,
    I want to download data from online shop site. For downloading I'm using QNetworkAccesManager and QNetworkReply. Main page loads correctly and without problem. On of next pages refuses to download and throw error - Host not found.

    Qt Code:
    1. m_ptrPriv->m_pReply = m_ptrPriv->m_NetAccesMgm.get(QNetworkRequest(stUrl));
    2. connect(m_ptrPriv->m_pReply, SIGNAL(finished()), this, SLOT(onPageDownloadFinished()));
    3. connect(m_ptrPriv->m_pReply, SIGNAL(readyRead()),this, SLOT(httpReadyRead()));
    4. connect(m_ptrPriv->m_pReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
    To copy to clipboard, switch view to plain text mode 

    After finished() signal m_pReply contain error mentioned above. URL is http:/www.proline.pl/?p=AMD+X4+II+965+AM3+B.
    I've tried program from QT Network examples - http. He returns the same problem. I can go to that addres by my browsers. HTML code of pages seems a little strange (addition of extra char '3D' in front of each TAG attributes value, which looks like some protection against web crawlers collecting data).
    Any idea how to solve this problem? 'Host not found' suggest that QT couldn't find site by address. I thought that QNetworkReply should deliver HTML page code without parsing or validation - thats why I refuse to use WebKit.
    Last edited by T4ng10r; 18th September 2011 at 20:29.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can't load HTML page with QNetworkReply

    Quote Originally Posted by T4ng10r View Post
    URL is http:/www.proline.pl/?p=AMD+X4+II+965+AM3+B.
    This is not a valid URL. Try:
    Qt Code:
    1. http://www.proline.pl/?p=AMD+X4+II+965+AM3+B
    To copy to clipboard, switch view to plain text mode 
    With the missing '/' Qt is finding no host name in the URL:
    Qt Code:
    1. QUrl url("http:/www.proline.pl/?p=AMD+X4+II+965+AM3+B");
    2. qDebug() << url.host() << url.scheme();
    To copy to clipboard, switch view to plain text mode 
    outputs:
    Qt Code:
    1. "" "http"
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to ChrisW67 for this useful post:

    T4ng10r (19th September 2011)

  4. #3
    Join Date
    Feb 2007
    Location
    Wroclaw, Poland
    Posts
    72
    Thanks
    6
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't load HTML page with QNetworkReply

    Dooh What a simple mistake. Thank you for help.

Similar Threads

  1. Hot do I get HTML source from a web page?
    By earendil in forum Newbie
    Replies: 9
    Last Post: 16th March 2012, 16:15
  2. Html page Display in QWebView
    By Tavit in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2010, 16:39
  3. Load image from QNetworkReply incorrectly
    By tqlong in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2010, 17:51
  4. Load HTML to QTextEdit
    By Gamalof in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2008, 19:08
  5. Widget to display an HTML page ?
    By probine in forum Qt Tools
    Replies: 3
    Last Post: 11th October 2006, 19:55

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.