I’m using twitter login for my site,when user entered with his twitter login id then how can I check this user is already registered in my database or new user.
and 1 more thing-
when I print print_r($user_info); then I received
stdClass Object
(
[id_str] => 395809931
[default_profile] => 1
[time_zone] =>
[created_at] => Sat Oct 22 08:45:33 +0000 2011
[profile_text_color] => 333333
[protected] =>
[default_profile_image] => 1
[profile_background_image_url] => http://a0.twimg.com/images/themes/theme1/bg.png
[name] => om nath
and more……..
)
how can I read and use this [id_str] .
Well, for starters, you can pull out the
id_strby accessing theid_strproperty of the$user_infoobject.After that, figuring out if they are already registered is dependent on how you are storing your users. Is twitter oauth the only mechanism for logging in? If so, then you can use the id_str as your primary key for your user table. Then you would just do a query against the DB to see if they exist. Assuming mysql, your query would be something like