Results 1 to 3 of 3

Thread: No output in HTTP request .. Help Required

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    8
    Qt products
    Qt3
    Platforms
    MacOS X

    Default No output in HTTP request .. Help Required

    Hi,

    I am trying to make a HTTP request. But when I am trying to bytearray output is null.
    Qt Code:
    1. public class test {
    2. private int httpGetId;
    3. private boolean httpRequestAborted;
    4. private QHttp qHttp;
    5. public test(){
    6. String url = "http://miniorb.in";
    7.  
    8. QUrl qURL = new QUrl(url);
    9. System.out.println(qURL.encodedHost());
    10. QHttpRequestHeader header = new QHttpRequestHeader("GET", "/index.html");
    11. header.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
    12. header.setValue("Pragma", "no-cache");
    13. header.setValue("Host","miniorb.in" );
    14.  
    15. qHttp = new QHttp();
    16. qHttp.setHost("minirob.in");
    17. qHttp.request(header);
    18.  
    19. httpGetId = qHttp.get(qURL.path());
    20. qHttp.requestFinished.connect(this, "httpRequestFinished(int,boolean)");
    21. qHttp.responseHeaderReceived.connect(this,"readResponseHeader(QHttpResponseHeader)");
    22.  
    23. QByteArray xyz = qHttp.readAll();
    24. System.out.println("xyz : " + xyz.size());
    25. System.out.println("print 1: " + qHttp.request(header));
    26. String str = "Divanshu On work";
    27. System.out.println("inside the finsihed()" + str);
    28. }
    29. private void httpRequestFinished(int requestId, boolean error)
    30. {
    31. System.out.println("httpRequestFinished");
    32. if (requestId != httpGetId){
    33. System.out.println("Error");
    34. return;
    35. }
    36.  
    37. }
    38. private void readResponseHeader(QHttpResponseHeader responseHeader)
    39. {
    40. if (responseHeader.statusCode() != 200) {
    41. httpRequestAborted = true;
    42. qHttp.abort();
    43. }
    44. }
    45. public static void main(String args[]){
    46. test window = new test();
    47. }
    48. }
    To copy to clipboard, switch view to plain text mode 

    please help me .. where I am doing wrong.

    Thanks in Advance !!
    Last edited by divanshu; 28th June 2011 at 07:43.

Similar Threads

  1. How to make a HTTP request in QTJambi
    By divanshu in forum Newbie
    Replies: 2
    Last Post: 28th June 2011, 06:29
  2. http request without signals and slots
    By whites11 in forum Newbie
    Replies: 6
    Last Post: 7th January 2010, 16:39
  3. HTTP request
    By Trok in forum Qt Programming
    Replies: 9
    Last Post: 5th January 2010, 14:49
  4. problem with Synchronous Http request
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 30th January 2009, 11:03
  5. http request
    By yagabey in forum Qt Programming
    Replies: 3
    Last Post: 28th December 2008, 19:19

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
  •  
Qt is a trademark of The Qt Company.