I want to show my last 5 or 10 statuses from twitter on my site. For now I am using following code to get my twitter statuses.
public function getOrganizationsTwitterUpdates(){
$twitter = new Zend_Service_Twitter('myusername', 'mypassword');
$response = $twitter->status->userTimeline();
return $response;
}
And I have to following response from above code.
Zend_Rest_Client_Result Object ( [_sxml:protected] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => array ) [status] => Array ( [0] => SimpleXMLElement Object ( [created_at] => Wed Dec 30 11:02:13 +0000 2009 [id] => 7192975030 [text] => This is my 2nd tweet. [source] => web [truncated] => false [in_reply_to_status_id] => SimpleXMLElement Object ( ) [in_reply_to_user_id] => SimpleXMLElement Object ( ) [favorited] => false [in_reply_to_screen_name] => SimpleXMLElement Object ( ) [user] => SimpleXMLElement Object ( [id] => 100469557 [name] => naveed [screen_name] => naveedriksof [location] => SimpleXMLElement Object ( ) [description] => SimpleXMLElement Object ( ) [profile_image_url] => http://s.twimg.com/a/1262113883/images/default_profile_6_normal.png [url] => SimpleXMLElement Object ( ) [protected] => false [followers_count] => 0 [profile_background_color] => 9ae4e8 [profile_text_color] => 000000 [profile_link_color] => 0000ff [profile_sidebar_fill_color] => e0ff92 [profile_sidebar_border_color] => 87bc44 [friends_count] => 0 [created_at] => Wed Dec 30 10:59:31 +0000 2009 [favourites_count] => 0 [utc_offset] => SimpleXMLElement Object ( ) [time_zone] => SimpleXMLElement Object ( ) [profile_background_image_url] => http://s.twimg.com/a/1262113883/images/themes/theme1/bg.png [profile_background_tile] => false [notifications] => false [geo_enabled] => false [verified] => false [following] => false [statuses_count] => 2 ) [geo] => SimpleXMLElement Object ( ) ) [1] => SimpleXMLElement Object ( [created_at] => Wed Dec 30 11:01:43 +0000 2009 [id] => 7192966364 [text] => This is my 1st tweet [source] => web [truncated] => false [in_reply_to_status_id] => SimpleXMLElement Object ( ) [in_reply_to_user_id] => SimpleXMLElement Object ( ) [favorited] => false [in_reply_to_screen_name] => SimpleXMLElement Object ( ) [user] => SimpleXMLElement Object ( [id] => 100469557 [name] => naveed [screen_name] => naveedriksof [location] => SimpleXMLElement Object ( ) [description] => SimpleXMLElement Object ( ) [profile_image_url] => http://s.twimg.com/a/1262113883/images/default_profile_6_normal.png [url] => SimpleXMLElement Object ( ) [protected] => false [followers_count] => 0 [profile_background_color] => 9ae4e8 [profile_text_color] => 000000 [profile_link_color] => 0000ff [profile_sidebar_fill_color] => e0ff92 [profile_sidebar_border_color] => 87bc44 [friends_count] => 0 [created_at] => Wed Dec 30 10:59:31 +0000 2009 [favourites_count] => 0 [utc_offset] => SimpleXMLElement Object ( ) [time_zone] => SimpleXMLElement Object ( ) [profile_background_image_url] => http://s.twimg.com/a/1262113883/images/themes/theme1/bg.png [profile_background_tile] => false [notifications] => false [geo_enabled] => false [verified] => false [following] => false [statuses_count] => 1 ) [geo] => SimpleXMLElement Object ( ) ) ) ) )
I have 2 question:
Q1. How to convert above object into array. In above object I can see my two statuses but how can I store my status into variable like this.
$firstStatus = "This is my first tweet"; $firstStatusTime = "4:30PM 12-12-09"; $secondStatus = "This is my second tweet"; $secondStatusTime = "9:30PM 12-12-09";
Q2. Can I get my all statuses without my password (As we can see anyone's status on web). I dont want to use RSS.