ZendAMF and the Twitter API

Have you ever had the urge to roll your own twitter? Well I have and I have tried a number of methods to come to the conclusion I needed to write everything from scratch. So I did and I wouldn’t say that I wasn’t without help. I did study Lee Brimelow’s gotoandlearn.com ZendAMF tutorial. So I went about downloading and install zend on my server and I found it was extremely easy to use. One of the many things that attracted me to the Zend framework were the prebuilt services. The zend framework is a mature framework that has a great deal to offer developers so I will briefly show you a simple amf flash gateway built with zend to fetch the twitter service. Also please note you will have to create your own classes if you want to extend this but it should be pretty easy to do considering..
Click to go to example

So first off download the zendframework. Configure your zendAMF endpoint.
Create your own ZendAMF endpoint:

setClass("TwitService");
echo ( $server -> handle() );
?>

Now configure your zend Twitter Service
Create Your Twitter Service Class:

status->friendsTimeline();
	 $tmp = new VOgetFriendsTimeline();
	 for ($i = 0; $i <= 18; $i++){
			// array_push($tmp->userTwit, $response->status[$i]);
	 		array_push($tmp->userTwit, (string)$response->status[$i]->user->screen_name);
	 		array_push($tmp->statusPic, (string)$response->status[$i]->user->profile_image_url);
	 		array_push($tmp->locTwit, (string)$response->status[$i]->user->location);
     		array_push($tmp->friendsTimeline, (string)$response->status[$i]->text);
	 	}
	 return $tmp;
	 }
	 
	 public function UserPostUpdate($tweet){
	 $twitter = new Zend_Service_Twitter('YourUserName', 'YourPassword');
	 $response = $twitter->status->update($tweet);	 
	 }


}

Now configure your flash variable object that is exposed by the service.


Finally configure your flex project to consume the service.



	
        
	
	
    
        
            
			 
            
        
    

	
	
	
	
	
	
	
	
	

Code

Thats it! View the live example here!

Other Cool Twitter Mashup links can be found:

Twitter MashUp Links


Don't forget to check out Lee Brimelow's GotoandLearn AMF video.

Zend framework
Zend Services

← Previous post

Next post →

2 Comments

  1. thank you for sharing… 😀

  2. thank you for sharing… 😀

Leave a Reply