PHP Programmer’s Of Bangladesh

Twitter: micro blogging site

Posted by: Md. Masud on: May 10, 2008

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

Posted by: Md. Masud on: November 28, 2007

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

Tags: , ,

Searching video Using YouTube API

Posted by: Md. Masud on: November 22, 2007

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

Posted by: Md. Masud on: November 18, 2007

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.

Creating RSS Feed [Beganing]

Posted by: Md. Masud on: October 29, 2007

RSS Feed is one of the best thing in modern web world. But most of the time we are not able to create our own RSS Feed. But can you imagine its simply easy when you know how to write them. Here is a beganing example to write a RSS Feed:

<?php

header( ‘Content-type: text/xml’);

?>

<rss version=”2.0″>
<channel>
<title> WordPress </title>
<description> This is a test site for WordPress </description>
<link> phpprogrammerofbangladesh.wordpress.com </link>

<?php

mysql_connect( ‘localhost’, ‘root’, ” ) or die( mysql_error() );
mysql_select_db( ‘wordpress’) or die( mysql_error() );

$sql_query = “select ID, post_date, post_title, post_content from wp_posts ORDER BY post_date DESC LIMIT 0,5″;

$result     = mysql_query( $sql_query );
while( $row = mysql_fetch_row( $result ) )
{
?>
<item>
<title>       <?=htmlentities(strip_tags($row[2]));?>             </title>
<description> <?=htmlentities( strip_tags($row[3]) );?>           </description>
<link> http://localhost/wordpress/index.php?post_id=<?=$row[0];?> </link>
<pubDate>     <?=$row[1];?>                                       </pubDate>
</item>
<?php
}
?>
</channel>
</rss>

You can have more details about RSS Feed Creation from the following links

  • http://www.tiffanybbrown.com/2005/12/22/dynamic-rss-feeds-using-php-mysql-and-apache
  • http://www.owalog.com/blog.php?myess1=47
  • http://www.tutorialized.com/view/tutorial/Creating-Dynamic-RSS-Feeds-with-PHP-and-MySQL/15948
  • http://www.devshed.com/c/a/MySQL/Creating-an-RSS-Reader-the-Reader/

Where I was???

I was a PHP/MySQL web application developer in EVOKNOW INC from 1st July, 2006 to 5th Nov, 2007.

Blog Stats

  • 27,587 hits

What is the date?????

December 2009
S S M T W T F
« May    
 1234
567891011
12131415161718
19202122232425
262728293031  

My Links in Del.icio.us

Google Adds