Results 1 to 3 of 3

Thread: How to make a HTTP request in QTJambi

Hybrid View

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

    Default How to make a HTTP request in QTJambi

    How I can make a HTTP request in QT jambi.

    Qt Code:
    1. QUrl qURL = new QUrl(url);
    2. System.out.println(qURL.encodedHost());
    3. QHttpRequestHeader header = new QHttpRequestHeader("GET", "/index.html");
    4.  
    5. header.setValue("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)");
    6. header.setValue("Pragma", "no-cache");
    7.  
    8. header.setValue("Host","miniorb.in" );
    9.  
    10. QObject qObject = new QObject();
    11.  
    12. QHttp qHttp = new QHttp();
    13. qHttp.setHost("minirob.in");
    14. //qHttp.currentRequest();
    15. qHttp.request(header);
    16.  
    17.  
    18.  
    19.  
    20.  
    21. QByteArray xyz = qHttp.readAll();
    To copy to clipboard, switch view to plain text mode 

    I tried to connect with the page in this way. but when I am trying to read it, it is giving me blank output. help me how i can fix it.


    Thanks In advance !!!

  2. #2
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    164
    Thanks
    1
    Thanked 26 Times in 26 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: How to make a HTTP request in QTJambi

    You must connect void QHttp::requestFinished ( int id, bool error ) or QHttp::done ( bool error ) to some of your slots and then use readAll().

Similar Threads

  1. http request without signals and slots
    By whites11 in forum Newbie
    Replies: 6
    Last Post: 7th January 2010, 16:39
  2. HTTP request
    By Trok in forum Qt Programming
    Replies: 9
    Last Post: 5th January 2010, 14:49
  3. problem with Synchronous Http request
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 30th January 2009, 11:03
  4. 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.