Wait you don't need to read the whole thing :) Just scroll down, and see what I've asked.
stdClass Object
(
[friends_count] => 54
[description] => i'TS THE digiTAL vERSiOn 0b devilZ! tECH & mUUsic fReak.
sImpLE buT.......!
[screen_name] => 2020Volt
[profile_sidebar_border_color] => 181A1E
[status] => stdClass Object
(
[in_reply_to_user_id_str] => 83300174
[place] =>
[coordinates] =>
[contributors] =>
[in_reply_to_screen_name] => Anik1990
[geo] =>
[retweet_count] =>
[source] => Seesmic Web
[retweeted] =>
[in_reply_to_status_id] => 29180026185
[created_at] => Sat Oct 30 13:04:53 +0000 2010
[in_reply_to_user_id] => 83300174
[truncated] =>
[in_reply_to_status_id_str] => 29180026185
[id] => 29181306201
[id_str] => 29181306201
[favorited] =>
[text] => @Anik1990 its just my point of view man.....
)
[geo_enabled] => 1
[follow_request_sent] =>
[time_zone] => Dhaka
[favourites_count] => 1
[verified] =>
[notifications] =>
[profile_background_color] => 1A1B1F
[url] => http://techysafi.wordpress.com
[lang] => en
[profile_use_background_image] => 1
[created_at] => Tue Sep 21 15:28:38 +0000 2010
[profile_text_color] => 666666
[location] => Dhaka,Bangladesh[listed_count] => 6
[protected] =>
[statuses_count] => 1962
[profile_background_image_url] => http://s.twimg.com/a/1288217225/images/themes/theme9/bg.gif
[profile_link_color] => 2FC2EF
[name] => Tech Freak Satan
[show_all_inline_media] =>
[following] =>
[profile_image_url] => http://a1.twimg.com/profile_images/1146520409/SDC11078_normal.jpg
[id] => 193332358
[id_str] => 193332358
[开发者_StackOverflow中文版contributors_enabled] =>
[profile_background_tile] =>
[utc_offset] => 21600
[profile_sidebar_fill_color] => 252429
[followers_count] => 60
)
Now my Question is HOW I can turn [text] into a variable like $tweet ?? and the [name] as well. Because I want to store them on mysql, so I need to retrieve the value of [text] & [name] !
$sdjkf->status->text; this is not returning anything !
I saw a related post How would i access the properties in this object? Twitter API on here but my case is kinda different. Just browse this link, if you wish.
(Im begging your pardon, pls don't treat me as a professional so whatever you gonna say, say it completely & clearly...and I know Im stupid :-)
Thanks in advance
assuming that you have the stdClass
object (as you listed above) stored in a php variable called $response
, you can put the text
attribute into a php variable called $tweet
like this:
$tweet = $response->status->text;
likewise, with the name:
$tweeter_name = $response->screen_name;
You can use foreach()
loop to get the object values in loop something like the following :
foreach($tweet as $value)
{echo "Screen Name : ".$value->screen_name."<br>";
echo "Tweet : ". $value->text."<br>";
}
精彩评论