Results 1 to 2 of 2

Thread: Interacting with an API

  1. #1
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Interacting with an API

    I need to talk to an API that can send some information back.

    For example a twitter API that returns the latest Tweets.

    I have written a working php code but i am not able to do the same using Qt.

    My has to do the following functions.
    -Talk to the API
    -Receive Information
    -Display the information

    I have used Qt for other purpsoses such as talking to a DLL but i do not know much about Qt and Internet.

    Hopefully someone can help me to solve the problem.
    here is my php code

    <html>
    <head><title>
    Twitter API
    </title></head>
    </html>

    <?php

    $login = "1"; //Add the Usernameassword for authenticated sessions

    $tweets = "http://twitter.com/statuses/public_timeline.xml";

    $tw = curl_init();
    curl_setopt($tw, CURLOPT_URL, $tweets);
    curl_setopt($tw, CURLOPT_USERPWD,$login);
    curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);

    $twi = curl_exec($tw);
    $tweeters = new SimpleXMLElement($twi);
    $latesttweets = count($tweeters);

    //echo the data

    foreach ($tweeters->status as $twit1) {

    echo "<div class='name'>",'<b>'.$twit1->user->name.'</b>',"</div>";
    echo "<div class='text'>".$twit1->text." <div class='description'>","</div></div></div>";

    }

    curl_close($tw);

    ?>

  2. #2
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Interacting with an API

    You don't need to keep creating the same topic multiple times. We've already told you how to do it in the other topics. Read it and learn it. We won't do the work for you.

    http://www.qtcentre.org/forum/f-qt-p...-qt-19617.html
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

Similar Threads

  1. qt application interacting with GSMmodem in windows
    By jjbabu in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2007, 11:22
  2. events interacting with signals/slots
    By gunhelstr in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2006, 12:30

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.