Results 1 to 5 of 5

Thread: Read live stock quoted from a website using qt4 c++?

  1. #1
    Join Date
    Feb 2010
    Posts
    31
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Windows

    Question Read live stock quoted from a website using qt4 c++?

    Hi
    I want to read all the information available from the website "http://www.nseindia.com/marketinfo/comp… about the stock DLF.

    I am using Qt4 C++.
    Being a newbie I need some help for the same.

    Thanks in Advance.

  2. #2
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Read live stock quoted from a website using qt4 c++?

    You need to use these classes QNetworkAccessManager, QNetworkReply, QNetworkRequest to send requests and get a reply where you can manipulate the data you got.
    There are some examples in the documentation showing the use of those classes.
    Hope to helped a little
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

  3. #3
    Join Date
    Feb 2010
    Posts
    31
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Windows

    Default Re: Read live stock quoted from a website using qt4 c++?

    I have tried it. But am not able to read the data into string. Below is my code. Can u tell what is the error that I am doing...

    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    QNetworkRequest request;
    request.setUrl(QUrl("http://mobile.flightview.com/TrackByFlight.aspx"));
    QNetworkReply *reply = manager->get(request);
    textArea = new QTextBrowser;
    if (reply->error() == QNetworkReply::NoError){
    textArea->setText("[" + QDateTime::currentDateTime().toString() + "] :: "\
    "The file has been successfully read from the network");
    textArea->append("[" + QDateTime::currentDateTime().toString() + "] :: "\
    "URL Used: " + reply->url());
    QByteArray bytes = reply->readAll();
    QString string = QString::fromUtf8(bytes);
    QString Temp_1;
    Temp_1 = string.section(",", 0,0);
    textArea->append("[" + QDateTime::currentDateTime().toString() + "] :: "\
    "Reply size: \n" + reply->error());
    textArea->append("[" + QDateTime::currentDateTime().toString() + "] :: "\
    "Line Read :\t" + Temp_1);
    }else{
    textArea->append("[" + QDateTime::currentDateTime().toString() + "] :: "\
    "There is an error reading from network...");
    }

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read live stock quoted from a website using qt4 c++?

    The call is asynchronous - use a slot.

  5. #5
    Join Date
    Feb 2010
    Posts
    31
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Windows

    Default Re: Read live stock quoted from a website using qt4 c++?

    Thanks fatjuicymole. It works fine now. I have to now parse the html code to get the desired output.
    Last edited by abghosh; 21st February 2010 at 03:12.

Similar Threads

  1. Qt application with live Active X camera feed.
    By bitChanger in forum Qt Programming
    Replies: 8
    Last Post: 4th September 2012, 19:26
  2. QGraphicsview/Scene in live application
    By skimpax in forum Qt Programming
    Replies: 0
    Last Post: 11th February 2010, 17:04
  3. Live Straming Media Player
    By keyur259 in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2010, 09:09
  4. QRegExp parsing matched quoted strings
    By jhndnn in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2010, 23:05
  5. Stock Icons
    By wswartzendruber in forum Newbie
    Replies: 2
    Last Post: 14th February 2009, 09:31

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.