Results 1 to 4 of 4

Thread: get website info with QWebPage

  1. #1
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Default get website info with QWebPage

    I'd like to know how many bytes a website contains (let's say www.google.com).
    I think I need to use QWebPage and bytesReceived() for that. However, I don't know how to specifify the URL for it.

    This is what I have:
    Qt Code:
    1. QWebPage * page = new QWebPage();
    2. //missing code here
    3. int bytes = page->bytesReceived();
    To copy to clipboard, switch view to plain text mode 

    but how do I specify the website URL to be opened for this?
    Last edited by timmu; 23rd August 2009 at 12:58.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: get website info with QWebPage

    You don't need QWebPage. Just download the page using QNetworkAccessManager and see how many bytes were received. Alternatively issue a HEAD request with QTcpSocket or QHttp and you'll receive information about the page size within the headers without the actual data.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    timmu (25th August 2009)

  4. #3
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: get website info with QWebPage

    Great, but which one of these options is easiest to use and fastest to execute when all I want is to detect whether or not a given website exists?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: get website info with QWebPage

    QTcpSocket with a HEAD request (or even without it but then connecting to a web server doesn't yet mean the website exists).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Plug-in widgets always on top in QWebPage
    By serras in forum Qt Programming
    Replies: 3
    Last Post: 29th July 2011, 03:22
  2. Can QWebPage see changes in a website
    By probine in forum Qt Programming
    Replies: 3
    Last Post: 15th August 2009, 23:23
  3. QwebPage within a QGraphicsWidget
    By Osprey in forum Qt Programming
    Replies: 0
    Last Post: 16th June 2009, 17:32
  4. How to activate form buttons in a QWebPage
    By redneon in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2009, 15:58
  5. Programmatically Save Image rendered in a QWebPage
    By last2kn0 in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2008, 06:33

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.