Twitter: micro blogging site

Twitter is one of the micro blogging site in the world. Actually people used Twitter answering a question “what are you doing?”. Twitter has done some great thing like included jaber interface to post directly from google talk or other IM who support jaber API. Twiter also provide a small API, by which you can post your msg from other site.

The API is looks like this which is collected from google code. Here is a simple view

function postToTwitter($username,$password,$message)
{

    $host = "http://twitter.com/statuses/update.xml?source=SITE_NAME&
             status=".urlencode(stripslashes(urldecode($message)));

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);

    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);

    curl_close($ch);

    if($resultArray['http_code'] == "200"){
         $twitter_status='Your message has been sent! 
         <a href="http://twitter.com/'.$username.'">See your profile</a>';
    } else {
         $twitter_status="Error posting to Twitter. Retry";
    }
    return $twitter_status;
}
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }you just need a twitter account name & password and simply passed it to the function parameter and you will see the action in twitter. You can send the source name from where you send the message.

I have recently add this features to one of my application development and hereby i share this knowledge with all of you. good luck 🙂

NB: To see the code working you should activate the curl library from php.ini

Reference: twitter api is used from http://code.google.com

DateJS – A Javascript Date Library

Smashing Magazine site is one of my favorite site for latest news on IT technology. Today i read the magazine and found really a interesting JavaScript library about date functionality. It do some amazing thing on the fly and the functions are very much user friendly. you can easily understand and remember those function name and their functionality. Here are some example that i found in the dateJS site.

DateJS Example

I hope all of you will have lots of fun just using this library. Please mention if you made any change to this library for better performance.

reference: http://www.datejs.com

Searching video Using YouTube API

In my recent project I have to do something like that:

  • Enter a TAG, inside a text box
  • Search in Flickr using the tag.
  • Show the search result inside my page.
  • Search in YouTube using the same tag.
  • Show the search result inside my page.
  • Play the video in my page without redirecting to the YouTube original site.

To do the following job I use Flickr API & YouTube API which helps me most. It’s become very much easy, which was too much difficult for me.

For YouTube there are lots of API available, but I found following API very much effective. You can download the API from the following link:

http://waxjelly.wordpress.com/2007/03/08/youtube-api-class-redeaux/

You just have to do the following thing:

image1

image2

It used two activeX bases Javascript class to show the video in your own page without redirecting to the orginal page.

i am feeling two much happy to have such usefull API. 🙂

 

smashingmagazine.com

smashing Magazine is one of the best site that i ever find in the internet. i just heard about this. It published several articles on different aspect of programming. You can easily increase your technical knowledge from this. This site always updated with latest article, tutorial etc. It includes article and tutorial on

CSS, AJAX, PHP, Web 2.0, Ruby, XML, DHTML, JS, framework and many more.

I get much help from this site and become a big fan of this site. I hope it will also works for you.