Results 1 to 2 of 2

Thread: QHttp get returns the wrong page

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question QHttp get returns the wrong page

    I'm using a bit of code my brother made so I'm not the expert though I understand the basics of it, I think.

    Qt Code:
    1. serverConnection = new QHttp("www.web.be");
    2. connect(serverConnection, SIGNAL(requestFinished(int,bool)), this, SLOT(serverStatus(int,bool)));
    3. serverConnection->get("/status.php");
    4. serverConnection->readAll();
    To copy to clipboard, switch view to plain text mode 

    Using qDebug it shows that instead of getting a simple "1" or "2" it gets a whole different page then status.php

    Qt Code:
    1. "<head>
    2. <meta http-equiv="refresh" content="0;url=http://ifastnet.com/notify2.html" />
    3. </head>
    4. <html>
    5. <body>
    6. <script LANGUAGE="JavaScript">
    7. window.location="http://ifastnet.com/notify2.html";
    8. </script>
    9. <!-- 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 526 640 917 51 415 140 573 716 965 688 395 829 76 810 801 733 244 95 205 283 488 189 705 173 743 574 947 608 694 973 886 298 223 449 99 309 936 432 209 623 454 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 526 640 917 51 415 140 573 716 965 688 395 829 76 810 801 733 244 95 205 283 488 189 705 173 743 574 947 608 694 973 886 298 223 449 99 309 936 432 209 623 454 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 526 640 917 51 415 140 573 716 965 688 395 829 76 810 801 733 244 95 205 283 488 189 705 173 743 574 947 608 694 973 886 298 223 449 99 309 936 432 209 623 454 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 526 640 917 51 415 140 573 716 965 688 395 829 76 810 801 733 244 95 205 283 488 189 705 173 743 574 947 608 694 973 886 298 223 449 99 309 936 432 209 623 454 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 399 310 772 188 121 747 908 375 658 989 471 891 842 282 539 788 863 526 640 917 51 415 140 573 716 965 688 395 829 76 810 801 733 244 95 205 283 488 189 705 173 743 574 947 608 694 973 886 298 223 449 99 309 936 432 209 623 454 -->
    10. </body>
    11. </html>
    12.  
    13. <BR clear="all">
    14. <HR noshade size="1px">
    15. <ADDRESS>
    16. Generated Sun, 14 Nov 2010 10:59:05 GMT by demil1.byetcluster.com (Lusca/LUSCA_HEAD-r14756)
    17. </ADDRESS>
    18. </BODY></HTML>
    19. "
    To copy to clipboard, switch view to plain text mode 

    I'm sure the file is there and named correctly as I can browse to it and download it. Any idea why this might be happening? Host related?

    greets,
    Speedy

  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: QHttp get returns the wrong page

    Line 3: QHttp::get() is not synchronous, so that at line 4 of the QHttp::readAll() may not have anything to read. It' s a moot point though because at line 4 you discard the QByteArray return by readAll() so we have no idea where your debug output is coming from.

    Is this the actual code or are you paraphrasing?

Similar Threads

  1. How can I support page up/page down on QTextEdit
    By wesley in forum Qt Programming
    Replies: 7
    Last Post: 14th September 2010, 19:18
  2. Replies: 11
    Last Post: 20th January 2009, 14:10
  3. QTabWidget remove a page at the page's request
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2007, 20:45
  4. Difference between QHttp::get and QHttp.request
    By LMZ in forum Qt Programming
    Replies: 2
    Last Post: 6th September 2007, 16:15
  5. Replies: 4
    Last Post: 27th July 2006, 11:13

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.