Updating Qaiku status with PHP

Qaiku is versatile microblogging service. It is originating its roots from a group of Finnish software developers and the idea to set up Qaiku stems from another Finnish microblogging platform, namely Jaiku, which once was quite popular. Today users of Jaiku are migrating to Qaiku and it already provides a great deal of various features, many of them are very innovative. Microblogging has become extremely popular. People keep updating their statuses almost around the clock and anywhere they happen to find themselves. Updating Qaiku status using their API is also pretty straightforward. Qaiku API is based on Twitter REST API, which is another very popular microblogging website.

I have written a short and simple PHP code to update the Qaiku status via their API. In order to start using Qaiku, you will need a free account as well as a free API key. You get the key by enabling API in your account settings. All calls to Qaiku must be authenticated and equipped with API key. The following little code snippet sends a status update.

$apiKey = 'your Qaiku API key'; $username = 'your Qaiku account username'; $password = 'your Qaiku account password'; $status = 'status=Enter your status message here'; $status .= "&apikey=$apiKey"; $s = curl_init(); curl_setopt($session, CURLOPT_URL, 'http://www.qaiku.com/api/statuses/update.json'); curl_setopt($s, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($s, CURLOPT_HEADER, false); curl_setopt($s, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($s, CURLOPT_RETURNTRANSFER, 1); curl_setopt($s, CURLOPT_POST, 1); curl_setopt($s, CURLOPT_POSTFIELDS, $message); curl_setopt($s, CURLOPT_USERPWD, "$username:$password"); $response = curl_exec($s); curl_close($s);

This call returns JSON encoded result. By changing the calling method to update.xml the response will be converted to XML. Use PHP 5.0 to decode the response with json_decode function. While this example only updates your status online Qaiku has a whole bunch of other methods to utilize. The basic syntax is shown in this sample programming excerpt, which can be easily expanded to comprehensive client application.

Julkaistu perjantaina 25.12.2009 klo 8:55 avainsanoilla Internet, ohjelmointi ja viestintä.

Edellinen
Valkoinen joulu
Seuraava
Band on the Run