View Full Version : Interacting with an API

5th April 2009, 15:12
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

Twitter API


$login = "1"; //Add the Username:password 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);

$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>";




5th April 2009, 15:17
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.