如何在twitter中获取当前用户的详细信息

问题描述:

我正在研究一个PHP应用程序,我希望获取有关使用OAuth的当前twitter用户的一些信息。如何在twitter中获取当前用户的详细信息

信息,如

  1. 网名
  2. 出生日期
  3. 电子邮件ID 4。时间区等

我已经完成了

    这些东西
  1. 创建一个twitter应用程序。
  2. 通过使用回调的登录URL获取oauth_token和oauth_verifier。

我需要像

$user = $connection->get('account/verify_credentials'); 

API请求语法,这将给上述细节,基本上相当于在Facebook上

$this->facebook->api('/me'); 

感谢。

+0

你使用了什么OAuth库? – Mob 2012-02-09 17:33:50

+4

Twitter API文档显示了您可以在https://dev.twitter.com/docs/api/1/get/users/show找到有关用户的内容。您可以从列表中获得#1和#4。 – jcmeloni 2012-02-09 17:36:28

+0

我已经使用TwitterOAuth v0.2.0-beta2。 – 2012-02-09 17:40:30

电子邮件地址不可用。你可以得到更多的DATAS本

https://dev.twitter.com/docs/api/1/get/users/show

与这个查询,你会得到这一切DATAS:在Twitter上论坛上关于电子邮件

{ 
    "profile_sidebar_fill_color": "e0ff92", 
    "name": "Twitter API", 
    "profile_sidebar_border_color": "87bc44", 
    "profile_background_tile": false, 
    "created_at": "Wed May 23 06:01:13 +0000 2007", 
    "profile_image_url": "http://a3.twimg.com/profile_images/689684365/api_normal.png", 
    "location": "San Francisco, CA", 
    "follow_request_sent": false, 
    "id_str": "6253282", 
    "profile_link_color": "0000ff", 
    "is_translator": false, 
    "contributors_enabled": true, 
    "url": "http://dev.twitter.com", 
    "favourites_count": 15, 
    "utc_offset": -28800, 
    "id": 6253282, 
    "profile_use_background_image": true, 
    "listed_count": 6868, 
    "profile_text_color": "000000", 
    "protected": false, 
    ... 

和更多信息: https://dev.twitter.com/discussions/1737

如果用户在你的数据库中没有电子邮件,我会做的就是在Twitter登录后将用户重定向到小型表单。

+0

。非常感谢。我使用电子邮件地址作为登录表单使用。任何方式我们都可以找到它? – 2012-02-10 02:33:08

+0

如果用户在你的数据库中没有电子邮件,我会做的就是在Twitter登录后将用户重定向到小型表单。 – 2012-02-10 10:05:30

+0

当然我也会这样做,需要用户填写表格。手动感谢 – 2012-02-10 13:35:43